제출 #1289254

#제출 시각아이디문제언어결과실행 시간메모리
1289254__ugur__카멜레온의 사랑 (JOI20_chameleon)C++20
40 / 100
17 ms444 KiB
#include "chameleon.h" #include <vector> #include <bitset> #include <iostream> #include <algorithm> using namespace std; void Solve(int N) { //cout << Query({1, 3, 4, 7}) << '\n'; //cout << Query({1, 2, 3, 4, 5, 6, 7, 8}) << '\n'; //cout << Query({3, 4, 5, 6, 7, 8}) << '\n'; //cout << Query({2, 3, 4, 5, 6, 8}) << '\n'; //cout << Query({2, 3, 4, 5, 6, 7}) << '\n'; //cout << Query({2, 3, 4, 5, 7, 8}) << '\n'; //cout << Query({2, 3, 4, 5, 7}) << '\n'; bitset<1001> found; vector<int> counts(2*N+1, 3); for(int i=1; i<=2*N; i++) { vector<int> tests; if(found[i]) continue; for(int j=2*N; j>0; j--) { if(found[j] || i == j) continue; if(Query({i, j}) == 1) { tests.push_back(j); counts[j]--; } if(tests.size() == counts[i]) break; } vector<int> check_same[counts[i]]; for(int j=1; j<=2*N; j++) { if(i == j) continue; for(int k=0; k<counts[i]; k++) { if(tests[k] != j) check_same[k].push_back(j); } } vector<int> results; for(int k=0; k<counts[i]; k++) results.push_back(Query(check_same[k])); int same = min_element(results.begin(), results.end()) - results.begin(); same = tests[same]; found[i] = 1; found[same] = 1; counts[same] = 0; counts[i] = 0; Answer(i, same); } }
#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...