제출 #163471

#제출 시각아이디문제언어결과실행 시간메모리
163471ioane곤돌라 (IOI14_gondola)C++14
컴파일 에러
0 ms0 KiB
/*/ #include "gondola.h"/**/ #include <bits/stdc++.h> #define LL long long #define PB push_back #define FOR(i,n) for (int i = 0; i < (n); i++) const LL N = 100005, NR = 250005; using namespace std; LL m, i, j, k, l, r, t; LL a[N], fox[NR]; bool fix[NR]; int valid(int n, int inputSeq[]){ t = NR; for ( i = 1; i <= n; ++i ){ if ( fix[inputSeq[i-1]] ) return 0; //cout << inputSeq[i-1] << " " << fix[inputSeq[i-1]] << endl; fix[inputSeq[i-1]] = 1; if ( inputSeq[i-1] <= n ){ t = inputSeq[i-1] - i; } } if ( t == NR ) return 1; for ( i = 1; i <= n; ++i ){ j = i + t; while ( j < 1 ) j += n; while ( j > n ) j -= n; a[j] = inputSeq[i-1]; } for ( i = 1; i <= n; ++i ){ if ( a[i] <= n && a[i] != i ) return 0; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]){ valid(n, gondolaSeq); t = 0; for ( i = 1; i <= n; ++i ){ fox[a[i]] = i; if ( t < a[i] ){ t = a[i]; } } for ( i = n + 1; i <= t; ++i ){ if ( !fox[a[i]] ) replacementSeq[i - n - 1] = fox[t]; else replacementSeq[i - n - 1] = fox[i]; m++; } return m; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; } /**/ int gondolaSequence[100001]; int replacementSequence[250001]; int main() { int i, n, tag; int nr; assert(scanf("%d", &tag)==1); assert(scanf("%d", &n)==1); for(i=0;i< n;i++) assert( scanf("%d", &gondolaSequence[i]) ==1); switch (tag){ case 1: case 2: case 3: printf("%d\n", valid(n, gondolaSequence)); break; case 4: case 5: case 6: nr = replacement(n, gondolaSequence, replacementSequence); printf("%d ", nr); if (nr > 0) { for (i=0; i<nr-1; i++) printf("%d ", replacementSequence[i]); printf("%d\n", replacementSequence[nr-1]); } else printf("\n"); break; case 7: case 8: case 9: case 10: printf("%d\n", countReplacement(n, gondolaSequence)); break; } return 0; } /**/

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp:2:21: warning: "/*" within comment [-Wcomment]
 #include "gondola.h"/**/
                      
/tmp/ccKDXSeT.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccvPVbHE.o:gondola.cpp:(.text.startup+0x0): first defined here
/tmp/ccKDXSeT.o:(.bss+0xf4260): multiple definition of `gondolaSequence'
/tmp/ccvPVbHE.o:(.bss+0xf4260): first defined here
/tmp/ccKDXSeT.o:(.bss+0x0): multiple definition of `replacementSequence'
/tmp/ccvPVbHE.o:(.bss+0x0): first defined here
/tmp/ccKDXSeT.o: In function `main':
grader.cpp:(.text.startup+0xc3): undefined reference to `countReplacement'
grader.cpp:(.text.startup+0xe2): undefined reference to `valid'
grader.cpp:(.text.startup+0x106): undefined reference to `replacement'
collect2: error: ld returned 1 exit status