답안 #1068024

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068024 2024-08-21T06:45:28 Z 12345678 웜뱃 (IOI13_wombats) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=5005;

int n, r, res=INT_MAX, st;
vector<int> p(2*nx), pw(2*nx), npw(2*nx);

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>r;
    r=(r%n)+2*n;
    for (int i=0; i<2*n; i++) cin>>p[i];
    for (int i=0; i<2*n; i+=2)
    {
        pw[i]=p[0];
        for (int j=0; j<i; j++) pw[j]=p[j+1];
        for (int j=i+1; j<2*n; j++) pw[j]=p[j];
        for (int t=0; t<r; t++)
        {
            for (int j=2; j<2*n; j+=2)
            {
                if (pw[j]<pw[j+1]) npw[j-2]=pw[j], npw[j+1]=pw[j+1];
                else npw[j-2]=pw[j+1], npw[j+1]=pw[j];
            }
            if (pw[0]<pw[1]) npw[1]=pw[0], npw[2*(n-1)]=pw[1];
            else npw[1]=pw[1], npw[2*(n-1)]=pw[0];
            pw=npw;
        }
        for (int j=0; j<2*n; j++) 
        {
            if (pw[j]==p[0]) 
            {
                if (j/2<=res) res=j/2, st=(i/2)+1;
            }
        }
    }
    cout<<st;
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
/usr/bin/ld: /tmp/cc3Okh7z.o: in function `main':
wombats.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0T0MeA.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc0T0MeA.o: in function `main':
grader.c:(.text.startup+0x129): undefined reference to `init'
/usr/bin/ld: grader.c:(.text.startup+0x194): undefined reference to `escape'
/usr/bin/ld: grader.c:(.text.startup+0x203): undefined reference to `changeH'
/usr/bin/ld: grader.c:(.text.startup+0x26d): undefined reference to `changeV'
collect2: error: ld returned 1 exit status