제출 #1026426

#제출 시각아이디문제언어결과실행 시간메모리
1026426gygArt Collections (BOI22_art)C++17
100 / 100
934 ms1916 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 4e3 + 5; int n; array<int, MAX_N> pos; void move(vector<int>& x) { assert(x.size()); int y = x[0]; x.erase(x.begin()); x.push_back(y); } void solve(int _n) { n = _n; vector<int> list; for (int i = 1; i <= n; i++) list.push_back(i); int prev = publish(list); for (int i = 1; i < n; i++) { move(list); int cur = publish(list); pos[i] = (prev - cur + n - 1) / 2 + 1; prev = cur; } unordered_set<int> vals; for (int i = 1; i <= n; i++) if (pos[i] != 0) vals.insert(pos[i]); for (int i = 1; i <= n; i++) { if (pos[i] != 0) continue; for (int j = 1; j <= n; j++) if (!vals.count(j)) pos[i] = j; } vector<int> ans(n); for (int i = 1; i <= n; i++) ans[pos[i] - 1] = i; answer(ans); }

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

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...