제출 #748151

#제출 시각아이디문제언어결과실행 시간메모리
748151inventiontimeArt Collections (BOI22_art)C++17
100 / 100
1570 ms828 KiB
#include "art.h"

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define re resize
#define ff first
#define ss second

#define all(x) (x).begin(), (x).end()
#define all1(x) (x).begin()+1, (x).end()
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, n) for(int i = 1; i <= n; i++)

#define print(x) cout << #x << ": " << x << endl << flush

template<class T> bool ckmin(T&a, T b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T b) { bool B = a < b; a = max(a, b); return B; }

typedef long long ll;
typedef vector<int> vi;

void solve(int n) {
    vi rank(n);
    vi comp(n+1);
    vi above(n+1);
    loop1(i, n) {
        loop(j, n) {
            if(i+j <= n) rank[j] = i+j;
            else         rank[j] = i+j-n;
        }
        comp[i] = publish(rank);
    }
    rank.assign(n, 0);
    loop1(i, n-1) rank[(comp[i] - comp[i+1] + n + 1)/2 - 1] = i;
    loop(i, n) if(!rank[i]) rank[i] = n;
    answer(rank);
}

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