Submission #714238

#TimeUsernameProblemLanguageResultExecution timeMemory
714238vjudge1Art Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define size(v) v.size() #define all(v) v.begin(), v.end() #define INF 2e9 #define f first #define s second using namespace std; int N; vector<int>a, in1, in2; int publish(std::vector<int>R){ for(int i = 0; i < N; i++){ in2[R[i]] = i; } int cnt = 0; for(int i = 0; i < N; ++i){ for(int j = 0; j < N; j++){ if(a[i] != R[j]){ if((in1[R[j]] > in1[a[i]]) && (in2[R[j]] < in2[a[i]])){ cnt++; } } } } return cnt; } void answer(std::vector<int>R){ for(int i : R){ cout << i << " "; } cout << "\n"; } void solve(int N){ vector<int>R(N); R = a; sort(all(R)); do{ if(!publish(R)){ answer(R); return; } } while(next_permutation(all(R))); } void grader(){ cin >> N; a.resize(N), in1.resize(N), in2.resize(N); for(int i = 0; i < N; ++i){ cin >> a[i]; in1[a[i]] = i; } solve(N); } int main() { grader(); }

Compilation message (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) {
      |        ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccX9qCHN.o: in function `publish(std::vector<int, std::allocator<int> >)':
interface.cpp:(.text+0x60): multiple definition of `publish(std::vector<int, std::allocator<int> >)'; /tmp/ccJXDStQ.o:art.cpp:(.text+0x380): first defined here
/usr/bin/ld: /tmp/ccX9qCHN.o: in function `answer(std::vector<int, std::allocator<int> >)':
interface.cpp:(.text+0x170): multiple definition of `answer(std::vector<int, std::allocator<int> >)'; /tmp/ccJXDStQ.o:art.cpp:(.text+0x460): first defined here
/usr/bin/ld: /tmp/ccX9qCHN.o: in function `main':
interface.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccJXDStQ.o:art.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status