# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
949998 | 2024-03-20T02:56:30 Z | pcc | Minerals (JOI19_minerals) | C++17 | 612 ms | 6540 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; /* int v = Query(1); Answer(i, 2 * N + 1 - i); */ #define pii pair<int,int> #define fs first #define sc second const int B = 14; const int mxn = 86011; vector<pii> req[B]; vector<int> v[2]; int pl,pr; vector<vector<int>> bk[B]; vector<pii> ans; void Solve(int N) { int pre = 0; for(int i = 1;i<=N*2;i++){ int tmp = Query(i); if(tmp==pre){ v[1].push_back(i); pre = Query(i); } else pre = tmp,v[0].push_back(i); } assert(v[0].size() == v[1].size()); req[0].push_back(pii(0,N-1)); bk[0].push_back({}); for(int i = 0;i<v[1].size();i++)bk[0].back().push_back(v[1][i]); pl = 0,pr = v[0].size()-1; for(int i = 0;i<B;i++){ if(req[i].empty())continue; while(pl>0){ pre = Query(v[0][--pl]); } while(pr>0){ pre = Query(v[0][pr--]); } cerr<<i<<endl; for(auto &j:req[i])cerr<<j.fs<<' '<<j.sc<<',';cerr<<endl; for(auto &j:bk[i]){for(auto &l:j)cerr<<l<<' ';cerr<<",";}cerr<<endl; assert(req[i].size() == bk[i].size()); for(int j = 0;j<req[i].size();j++){ auto [l,r] = req[i][j]; if(l == r){ ans.push_back(pii(bk[i][j][0],v[0][l])); continue; } int mid = (l+r)>>1; bk[i+1].push_back({}); bk[i+1].push_back({}); while(pr<mid){ pre = Query(v[0][++pr]); } cerr<<pl<<','<<pr<<":"<<pre<<endl; req[i+1].push_back(pii(l,mid)); req[i+1].push_back(pii(mid+1,r)); for(auto &m:bk[i][j]){ auto tmp = Query(m); if(pre == tmp)bk[i+1].end()[-2].push_back(m); else bk[i+1].end()[-1].push_back(m); pre = Query(m); } } } for(auto &i:ans)Answer(i.fs,i.sc); return; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 812 KB | Output is correct |
2 | Correct | 86 ms | 976 KB | Output is correct |
3 | Correct | 180 ms | 1524 KB | Output is correct |
4 | Correct | 385 ms | 3060 KB | Output is correct |
5 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 41 ms | 812 KB | Output is correct |
6 | Correct | 86 ms | 976 KB | Output is correct |
7 | Correct | 180 ms | 1524 KB | Output is correct |
8 | Correct | 385 ms | 3060 KB | Output is correct |
9 | Runtime error | 612 ms | 6540 KB | Execution killed with signal 11 |
10 | Halted | 0 ms | 0 KB | - |