Submission #15443

#TimeUsernameProblemLanguageResultExecution timeMemory
15443xhae로봇 심판의 님 게임 (kriii3_F)C++14
0 / 79
0 ms5628 KiB
#include <math.h> #include <stdio.h> #include <string.h> #include <vector> #include <string> #include <queue> #include <map> #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <sstream> #include <set> using namespace std; int main() { int N, M, K; cin >> N >> M >> K; vector<int> P(N), Q(M), cnt(K); for (int i=0; i<N; i++) cin >> P[i]; for (int i=0; i<M; i++) cin >> Q[i]; for (int i=0; i<K; i++) cin >> cnt[i]; vector<int> S(1000001); for (int i=0; i<N; i++) for (int j=P[i]; j<=1000000; j+=P[i]) S[j] --; for (int i=0; i<M; i++) for (int j=Q[i]; j<=1000000; j+=Q[i]) if (S[j] >= 0) S[j] ++; int cc = 0; for (int i=1; i<=1000000; i++) if (S[i] > 0) { cc ++; S[i] = cc; } else S[i] = -1; int xx = 0; for (int i=0; i<K; i++) if (S[cnt[i]] >= 0) xx ^= S[cnt[i]]; for (int i=0; i<K; i++) { int target = S[cnt[i]] ^ xx; if (S[cnt[i]] > 0 && target < S[cnt[i]]) { for (int j=0; j<=1000000; j++) if (S[j] == target) { cout << "1 " << cnt[i] - j << endl; break; } } else cout << "0 0" << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...