Skip to content

Instantly share code, notes, and snippets.

@hsuan1117
Created December 4, 2019 09:01
Show Gist options
  • Save hsuan1117/488eeced61c85c8e6cfcab5acc2b13c7 to your computer and use it in GitHub Desktop.
Save hsuan1117/488eeced61c85c8e6cfcab5acc2b13c7 to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
bool can[10000000];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
memset(can,0,sizeof(can));
int tt;
scanf("%i\n",&tt);
for(int mm=0; mm<tt; mm++) {
int studentNum;
scanf("%i\n",&studentNum);
int data[studentNum];
for(int m=0; m<studentNum; m++) {
int ttftt;
scanf("%i",&ttftt);
data[m] = ttftt;
}
for(int i=0; i<studentNum; i++) {
for(int j=i+1; j<studentNum; j++) {
int temp=data[i]+data[j];
if(can[temp]==0) {
can[temp]=1;
}
}
}
int ko;
scanf("%i\n",&ko);
for(int m=0; m<ko; m++) {
int f;
scanf("%i",&f);
if(can[f] == 1) {
cout << "Good!" << endl;
} else {
cout << "So Bad!" << endl;
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment