# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
988165 | 2024-05-24T07:42:12 Z | khanhphucscratch | Super Dango Maker (JOI22_dango3) | C++17 | 2043 ms | 848 KB |
#include<bits/stdc++.h> #include "dango3.h" using namespace std; /*int Query(vector<int> &x) { cout<<"? "; for(int i : x) cout<<i<<" "; cout<<endl; int a; cin>>a; return a; } void Answer(vector<int> &a) { cout<<"! "; for(int i : a) cout<<i<<" "; cout<<endl; }*/ void Solve(int n, int m) { //n: number of color bool f[n*m+1]; memset(f, 0, sizeof(f)); vector<vector<int>> wtf; for(int i = 1; i < n*m; i++){ int l = 0, r = wtf.size()-1, ans = -1; while(l <= r){ int mid = (l+r+2)/2-1; vector<int> question; for(int j = 0; j <= mid; j++){ for(int k : wtf[j]) f[k] = 1; } f[i] = 1; for(int j = 1; j <= n*m; j++) if(f[j] == 0) question.push_back(j); for(int j = 0; j <= mid; j++){ for(int k : wtf[j]) f[k] = 0; } f[i] = 0; int sus = Query(question); if(sus == m-mid-1){ans = mid; r = mid-1;} else l = mid+1; } if(ans == -1){ wtf.push_back({i}); //cout<<i<<" "<<wtf.size()<<endl; } else{ wtf[ans].push_back(i); //cout<<i<<" "<<ans+1<<endl; } } for(int i = 0; i < m; i++) if(wtf[i].size() < n) wtf[i].push_back(n*m); for(vector<int> i : wtf) Answer(i); } /*int main() { Solve(3, 2); }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 348 KB | Output is correct |
2 | Correct | 13 ms | 504 KB | Output is correct |
3 | Correct | 16 ms | 512 KB | Output is correct |
4 | Correct | 16 ms | 508 KB | Output is correct |
5 | Correct | 12 ms | 344 KB | Output is correct |
6 | Correct | 12 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 417 ms | 592 KB | Output is correct |
2 | Correct | 404 ms | 592 KB | Output is correct |
3 | Correct | 512 ms | 844 KB | Output is correct |
4 | Correct | 511 ms | 584 KB | Output is correct |
5 | Correct | 347 ms | 580 KB | Output is correct |
6 | Correct | 346 ms | 576 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1640 ms | 708 KB | Output is correct |
2 | Correct | 1609 ms | 848 KB | Output is correct |
3 | Correct | 2043 ms | 724 KB | Output is correct |
4 | Correct | 2036 ms | 708 KB | Output is correct |
5 | Correct | 1368 ms | 688 KB | Output is correct |
6 | Correct | 1422 ms | 688 KB | Output is correct |