답안 #1046500

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1046500 2024-08-06T15:54:06 Z vjudge1 Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include "art.h"
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define int long long
#define ld long double

signed main(){ios::sync_with_stdio(false);cin.tie(0);	
	vector<int> v;
    for(int i = 1;i<=n;i++)v.pb(i);

    int ans[n+1];
    for(int i = 0;i<n;i++){
        ans[i] = publish(v);
        v.pb(v[0]);
        v.erase(v.begin());
    }
    ans[n] = ans[0];
    for(int i = 0;i<n;i++){
        int x = ans[i] - (ans[i] + ans[i+1] - n + 1) / 2;
        v[x] = i + 1;
    }

    answer(v);
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:12:22: error: 'n' was not declared in this scope
   12 |     for(int i = 1;i<=n;i++)v.pb(i);
      |                      ^
art.cpp:12:30: error: 'class std::vector<long long int>' has no member named 'pb'
   12 |     for(int i = 1;i<=n;i++)v.pb(i);
      |                              ^~
art.cpp:14:13: error: 'n' was not declared in this scope
   14 |     int ans[n+1];
      |             ^
art.cpp:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         ans[i] = publish(v);
      |         ^~~
      |         abs
art.cpp:16:26: error: could not convert 'v' from 'vector<long long int>' to 'vector<int>'
   16 |         ans[i] = publish(v);
      |                          ^
      |                          |
      |                          vector<long long int>
art.cpp:17:11: error: 'class std::vector<long long int>' has no member named 'pb'
   17 |         v.pb(v[0]);
      |           ^~
art.cpp:20:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     ans[n] = ans[0];
      |     ^~~
      |     abs
art.cpp:26:12: error: could not convert 'v' from 'vector<long long int>' to 'vector<int>'
   26 |     answer(v);
      |            ^
      |            |
      |            vector<long long int>
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) {
      |        ~~~~~~~~~^~~~