제출 #748148

#제출 시각아이디문제언어결과실행 시간메모리
748148inventiontimeArt Collections (BOI22_art)C++17
70 / 100
1452 ms732 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 comp1(n+1);
    vi comp2(n+1);
    vi above(n+1);
    loop1(i, n) {
        loop(j, n) {
            if(j == 0)     rank[j] = i;
            else if(j < i) rank[j] = j;
            else           rank[j] = j+1;
        }
        comp1[i] = publish(rank);
        loop(j, n) {
            if(j == n-1)     rank[j] = i;
            else if(j < i-1) rank[j] = j+1;
            else             rank[j] = j+2;
        }
        comp2[i] = publish(rank);
    }
    loop1(i, n) rank[(comp1[i] - comp2[i] + n + 1)/2 - 1] = i;
    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...