# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
250203 | 2020-07-17T07:20:44 Z | dwsc | Minerals (JOI19_minerals) | C++14 | 136 ms | 262148 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; int n; int in[100010]; void solve(vector<int> v1,vector<int> v2,bool in1){ random_shuffle(v1.begin(),v1.end()); random_shuffle(v2.begin(),v2.end()); if (v1.size() == 1){ Answer(v1[0],v2[0]); return; } int stop = 0.382*(int)v1.size(); vector<int> v1a,v1b,v2a,v2b; int num; for (int i = 0; i < v1.size(); i++){ if (i < stop){ num = Query(v1[i]); //if (in[v1[i]]) cout << "Added" << " " << v1[i] << "\n"; //else cout << "Removed" << " " << v1[i] << "\n"; v1a.push_back(v1[i]); } else{ v1b.push_back(v1[i]); } } for (int i = 0; i < v2.size(); i++){ if (v2a.size() == stop){ v2b.push_back(v2[i]); continue; } if (v2b.size() == v2.size()-stop){ v2a.push_back(v2[i]); continue; } int temp = Query(v2[i]); if (in1 && in[v2[i]]){ if (temp < num) v2a.push_back(v2[i]); else v2b.push_back(v2[i]); } else if (in1 && !in[v2[i]]){ if (temp > num) v2a.push_back(v2[i]); else v2b.push_back(v2[i]); } else if (!in1 && in[v2[i]]){ if (temp == num) v2a.push_back(v2[i]); else v2b.push_back(v2[i]); } else{ if (temp == num) v2a.push_back(v2[i]); else v2b.push_back(v2[i]); } in[v2[i]] = 1-in[v2[i]]; num = temp; } solve(v1a,v2a,!in1); solve(v1b,v2b,in1); } void Solve(int N) { srand(3082); n = N; vector<int> v1,v2; int num = 0; for (int i = 1; i <= 2*N; i++){ if (v1.size() == N){ v2.push_back(i); continue; } int temp = Query(i); in[i] = 1; if (temp > num){ num++; v1.push_back(i); } else{ v2.push_back(i); } } solve(v1,v2,1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |