Submission #580525

#TimeUsernameProblemLanguageResultExecution timeMemory
580525Jarif_RahmanChameleon's Love (JOI20_chameleon)C++17
40 / 100
21 ms340 KiB
#include "chameleon.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; namespace { int query(vector<int> v){ for(int &x: v) x++; return Query(v); } void answer(int a, int b){ Answer(a+1, b+1); } } void Solve(int n){ vector<vector<int>> v(2*n); set<pair<int, int>> s; for(int i = 0; i < 2*n; i++) for(int j = 0; j < 2*n; j++){ if(i == j) continue; if(query({i, j}) == 1){ v[i].pb(j), s.insert({min(i, j), max(i, j)}); } } for(int i = 0; i < 2*n; i++){ if(v[i].size() < 3) continue; int a = v[i][0], b = v[i][1], c = v[i][2]; int rm = -1; if(query({i, a, b}) == 1) rm = c; else if(query({i, a, c}) == 1) rm = b; else rm = a; if(s.find({min(i, rm), max(i, rm)}) != s.end()) s.erase({min(i, rm), max(i, rm)}); } for(auto [a, b]: s) answer(a, b); }
#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...