제출 #651115

#제출 시각아이디문제언어결과실행 시간메모리
651115Specialistas13Art Collections (BOI22_art)C++17
0 / 100
1 ms336 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { vector<int> order; int poz[5000]; int comp[5000]; bool taken[5000]; int x, y, z, bad=0; for (int i=1; i<=N; i++){ order.push_back(i); poz[i]=0; comp[i]=0; taken[i]=false; } x=publish(order); for (int i=1; i<=N-1; i++){ order.clear(); for (int j=N-i; j>=1; j--){ order.push_back(j); } for (int j=N-i+1; j<=N; j++){ order.push_back(j); } y=publish(order); z=(x+y-((N-i)*(N-i-1)/2)-bad)/2; comp[N-i+1]=z; bad+=z*2; } for (int i=N; i>=2; i--){ poz[N-comp[i]]=i; cout<<i<<" poz "<<poz[N-comp[i]]<<"\n"; taken[N-comp[i]]=true; } cout<<poz[2]; for (int i=1; i<=N; i++){ if (!taken[i]){ poz[i]=1; //cout<<i; break; } } order.clear(); for (int i=1; i<=N; i++){ cout<<poz[i]; order.push_back(poz[i]); } answer(order); }

컴파일 시 표준 에러 (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...