# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1077868 | 2024-08-27T09:56:55 Z | 0npata | Super Dango Maker (JOI22_dango3) | C++17 | 262 ms | 1112 KB |
#include "dango3.h" #include<bits/stdc++.h> using namespace std; #define vec vector const int MXSZ = 400*25; vec<int> ri_to; vec<int> ri_from; int query(vec<int> v) { for(int i = 0; i<v.size(); i++) { v[i] = ri_to[v[i]]+1; //cerr << v[i] << ' '; } //cerr << '\n'; return Query(v); } void Solve(int N, int M) { srand(69); ri_to = vec<int>(N*M); iota(ri_to.begin(), ri_to.end(), 0); random_shuffle(ri_to.begin(), ri_to.end()); vec<vec<int>> cols_inds{}; vec<int> rem(N*M); iota(rem.begin(), rem.end(), 0); while(cols_inds.size() < N) { //cerr << "NEW ONE" << '\n'; vec<int> v{}; for(auto cis : cols_inds) { v.push_back(cis[0]); } int l = 0; int r = rem.size(); while(l<r) { int m = (l+r)/2; vec<int> qv = v; for(int i = 0; i<=m; i++) { qv.push_back(rem[i]); } //cerr << '\n'; int res = query(qv); if(res >= 1) { r = m; } else { l = m+1; } } vec<int> col_inds{rem[l]}; for(int i = 0; i<l; i++) v.push_back(rem[i]); // now v contains everything at least once except the col // therefore the first one will always correspond to the same col while(col_inds.size() < M) { //cerr << "HERE" << '\n'; l++; int last = l; int r = rem.size(); while(l<r) { int m = (l+r)/2; auto qv = v; for(int i = last; i<=m; i++) { qv.push_back(rem[i]); } int res = query(qv); if(res >= 1) { r = m; } else { l = m+1; } } col_inds.push_back(rem[l]); } assert(col_inds.size() == M); cols_inds.push_back(col_inds); set<int> nrem(rem.begin(), rem.end()); for(int ind : col_inds) { //cerr << ind << ' '; nrem.erase(ind); } //cerr << '\n'; rem = vec<int>(nrem.begin(), nrem.end()); } for(int i = 0; i<M; i++) { vec<int> ans(N); for(int j = 0; j<N; j++) { ans[j] = ri_to[cols_inds[j][i]]+1; } Answer(ans); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 348 KB | Output is correct |
2 | Correct | 8 ms | 576 KB | Output is correct |
3 | Correct | 9 ms | 348 KB | Output is correct |
4 | Correct | 9 ms | 348 KB | Output is correct |
5 | Correct | 12 ms | 584 KB | Output is correct |
6 | Correct | 9 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 99 ms | 600 KB | Output is correct |
2 | Correct | 105 ms | 604 KB | Output is correct |
3 | Correct | 106 ms | 604 KB | Output is correct |
4 | Correct | 100 ms | 624 KB | Output is correct |
5 | Correct | 101 ms | 600 KB | Output is correct |
6 | Correct | 101 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 262 ms | 1112 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |