Created
December 22, 2020 20:46
-
-
Save JanhaviDadhania/6a3c7d62a1515919ae832768b8b7ca61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "spoj_interactive.h" | |
#include <bits/stdc++.h> | |
#define MAX 500005 | |
long long int a[MAX],n,cnt[MAX]; | |
using namespace std; | |
void verdict_wrong(int i) | |
{ | |
fprintf(spoj_for_tested,"poof %d\n",i); | |
spoj_assert(false); | |
} | |
void finalizeIT(int score) | |
{ | |
fprintf(spoj_score, "%d", score); | |
} | |
int main() | |
{ | |
spoj_init(); | |
int t; | |
//read t from inputfile | |
fscanf(spoj_p_in,"%d", &t); | |
fprintf(spoj_p_info,"t from input file is : %d\n",t); | |
fprintf(spoj_for_tested,"%d\n",t); | |
while(t--) { | |
int hidden_no; | |
//read hidden no from input file | |
fscanf(spoj_p_in,"%d", &hidden_no); | |
fprintf(spoj_p_info,"Hidden No from input file is : %d\n",hidden_no); | |
//read from output file, whether the number is prime or not | |
int expected_out; | |
fscanf(spoj_p_out,"%d", &expected_out); | |
fprintf(spoj_p_info,"Expected output No. : %d\n", expected_out); | |
int n; | |
fscanf(spoj_t_out,"%d",&n); | |
fprintf(spoj_p_info,"n == 0 and t is %d\n", t); | |
fprintf(spoj_p_info,"their output is %d\n", n); | |
while(n!=1 && n!=0 && n<=400) { | |
fprintf(spoj_p_info,"n == 0 and t is %d\n", t); | |
fprintf(spoj_p_info,"their output is %d\n", n); | |
if(hidden_no % n == 0) { | |
fprintf(spoj_for_tested,"%s\n","YES"); | |
} | |
else if(hidden_no % n != 0) { | |
fprintf(spoj_for_tested,"%s\n","NO"); | |
} | |
fscanf(spoj_t_out,"%d",&n); | |
} | |
if(n == 1) { | |
if(expected_out == n) { | |
// finalizeIT(1); | |
continue; | |
} | |
else { | |
fprintf(spoj_p_info,"n == 1 and t is %d\n", t); | |
verdict_wrong(-1); | |
} | |
} | |
else if(n == 0) { | |
if(expected_out == n) { | |
// finalizeIT(1); | |
continue; | |
} | |
else { | |
fprintf(spoj_p_info,"j n == 0 and t is %d\n", t); | |
fprintf(spoj_p_info,"j their output is %d\n", n); | |
verdict_wrong(-1); | |
} | |
} | |
else if(n > 400) { | |
fprintf(spoj_p_info,"n == 400 and t is %d\n", t); | |
verdict_wrong(-1); | |
} | |
} | |
finalizeIT(1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment