Submission #804229

#TimeUsernameProblemLanguageResultExecution timeMemory
804229ZHIRDILBILDIZLibrary (JOI18_library)C++14
0 / 100
1 ms464 KiB
#include<bits/stdc++.h> #include "library.h" using namespace std ; const int N = 1000 ; bool us[N + 1] ; bool abu[N + 1][N + 1] ; //int Query(vector<int>& v) //{ // int num ; // cout << "? " ; // for(int i : v) // cout << i << ' ' ; // cout << '\n' ; // cin >> num ; // return num ; //} //void Answer(vector<int>&res) //{ // cout << "! " ; // for(int i : res) // cout << i << ' ' ; // exit(0) ; //} void Solve(int n) { vector<int> ans ; deque<int> d ; if(n <= 200) { us[1] = 1 ; d.push_back(1) ; for(int i = 1 ; i <= n ; i++) abu[i][i] = 1 ; while(d.size() != n) { for(int i = 1 ; i <= n ; i++) { if(us[i] || abu[d.back()][i]) continue ; abu[d.back()][i] = 1 ; abu[i][d.back()] = 1 ; vector<int> v ; v.push_back(d.back()) ; v.push_back(i) ; if(Query(v) == 1) { us[i] = 1 ; d.push_back(i) ; break ; } } for(int i = 1 ; i <= n ; i++) { if(us[i] || abu[d[0]][i]) continue ; abu[d[0]][i] = 1 ; abu[i][d[0]] = 1 ; vector<int> v ; v.push_back(d[0]) ; v.push_back(i) ; if(Query(v) == 1) { us[i] = 1 ; d.push_front(i) ; break ; } } } for(int i : d) ans.push_back(i) ; Answer(ans) ; } } //signed main() //{ // int n ; // cin >> n ; // Solve(n) ; // return 0 ; //}

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:34:24: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |         while(d.size() != n)
      |               ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...