# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28258 | 2017-07-16T04:14:55 Z | :thinking_face:(#1137, zych1751, Acka, suzy) | Play Onwards (FXCUP2_onward) | C++11 | 46 ms | 11784 KB |
#include <bits/stdc++.h> using namespace std; bool not_prime[5000000]; long long score[2]; bool visited[5000000]; int main () { not_prime[0] = not_prime[1] = false; for(int i = 2; i < 5000000; i++) { if(not_prime[i]) continue; for(int j = i*2; j < 5000000; j += i) not_prime[j] = true; } int n; scanf("%d", &n); priority_queue<int> pq[2]; int cur = 0; // 0 : ��� for(int i = 0; i < n*2; i++, cur^=1) { int a, net=cur^1; scanf("%d", &a); if(not_prime[a]) { if(pq[net].size() < 3) score[net] += 1000; else { int a, b; a = pq[net].top(); pq[net].pop(); b = pq[net].top(); pq[net].pop(); score[net] += pq[net].top(); pq[net].push(a); pq[net].push(b); } } else if(visited[a]) score[cur] -= 1000; else { visited[a] = true; pq[cur].push(a); } } if(score[0] > score[1]) printf("�Ҽ��� �� �����\n"); else if(score[0] == score[1]) printf("�쿭�� ���� �� ����\n"); else printf("�Ҽ� ������ ���Լ�\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 46 ms | 11784 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |