제출 #1120155

#제출 시각아이디문제언어결과실행 시간메모리
1120155vjudge1Art Collections (BOI22_art)C++17
100 / 100
1257 ms1916 KiB
#include <bits/stdc++.h> #include "art.h" using namespace std; void solve(int n) { vector<int> p; for(int i = 1; i <= n; i++) { p.push_back(i); } int cur = publish(p); vector<int> ans(n, -1); for(int i = 0; i < n - 1; i++) { reverse(p.begin(), p.end()); int d = p.back(); p.pop_back(); reverse(p.begin(), p.end()); p.push_back(d); int cur2 = publish(p); //a - b = cur - cur2; //a + b = n - 1 //2 * a = cur - cur2 + n - 1; int a = (cur - cur2 + n - 1)/2; ans[a] = d; cur = cur2; } int pos = 0; for(int i = 0; i < n; i++) { if(ans[i] == -1) { ans[i] = p[0]; } } answer(ans); }

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'void solve(int)':
art.cpp:25:9: warning: unused variable 'pos' [-Wunused-variable]
   25 |     int pos = 0;
      |         ^~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...