제출 #836255

#제출 시각아이디문제언어결과실행 시간메모리
836255LiudasMinerals (JOI19_minerals)C++17
70 / 100
32 ms3280 KiB
#include "minerals.h" #include "minerals.h" #include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <iostream> using namespace std; int last = 0; void div(vector<int> start, vector<int> end, int par){ int N = start.size(); vector<int> l, r, le, re; if(N == 1){ Answer(start[0], end[0]); return; } if(par == 1){ for(int i = 0; i < N/2; i ++){ last = Query(start[i]); l.push_back(start[i]); } for(int i = N/2; i < N; i ++){ r.push_back(start[i]); } for(int i = 0; i < N; i ++){ int t = Query(end[i]); if(t != last){ last = t; le.push_back(end[i]); } else{ re.push_back(end[i]); } } div(le, l, 1); div(r, re, 2); } else if (par == 2){ for(int i = 0; i < N/2; i ++){ last = Query(start[i]); l.push_back(start[i]); } for(int i = N/2; i < N; i ++){ r.push_back(start[i]); } for(int i = 0; i < N; i ++){ int t = Query(end[i]); if(t != last){ last = t; le.push_back(end[i]); } else{ re.push_back(end[i]); } } div(l, le, 0); div(r, re, 1); } if(par == 0){ for(int i = 0; i < N/2; i ++){ last = Query(start[i]); l.push_back(start[i]); } for(int i = N/2; i < N; i ++){ r.push_back(start[i]); } for(int i = 0; i < N; i ++){ int t = Query(end[i]); if(t == last){ last = t; le.push_back(end[i]); } else{ last = t; re.push_back(end[i]); } } div(l, le, 2); div(re, r, 1); } } void Solve(int N) { vector<int> start, end; for(int i = 0; i < N * 2; i ++){ int t = start.size(); int ans = Query(i+1); if(ans == t + 1){ start.push_back(i+1); } else{ end.push_back(i+1); Query(i+1); } } last = N; div(start, end, 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...