Submission #12797

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
127972015-01-03 14:28:01woqja125전선 연결하기 (GA9_wire)C++98
Compilation error
0 ms0 KiB
#include<stdio.h>
int d[600001];
int l[300001];
int ans[300001];
int a[300001], at=-1;
int b[300001], bt=-1;
int main()
{
int n, i;
int a, b, t;
a[++at] = b[++bt] = 10000000;
scanf("%d", &n);
for(i=1; i<=2*n; i++)
{
scanf("%d", d+i);
l[d[i]] = i;
}
for(i=1; i<=2*n; i++)
{
t = l[d[i]];
if(t == i) continue;
while(a[at] <= i) at--;
while(b[bt] <= i) bt--;
if(t > a && t > b)
{
// while(1);
printf("IMPOSSIBLE");
return 0;
}
if(t <= a[at] && (a[at] <= b[bt] || b[bt] < t) )
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

wire.cpp: In function 'int main()':
wire.cpp:11:8: error: invalid types 'int[int]' for array subscript
wire.cpp:11:18: error: invalid types 'int[int]' for array subscript
wire.cpp:22:13: error: invalid types 'int[int]' for array subscript
wire.cpp:23:13: error: invalid types 'int[int]' for array subscript
wire.cpp:30:15: error: invalid types 'int[int]' for array subscript
wire.cpp:30:25: error: invalid types 'int[int]' for array subscript
wire.cpp:30:34: error: invalid types 'int[int]' for array subscript
wire.cpp:30:43: error: invalid types 'int[int]' for array subscript
wire.cpp:32:10: error: invalid types 'int[int]' for array subscript
wire.cpp:35:20: error: invalid types 'int[int]' for array subscript
wire.cpp:35:30: error: invalid types 'int[int]' for array subscript
wire.cpp:35:38: error: invalid types 'int[int]' for array subscript
wire.cpp:35:47: error: invalid types 'int[int]' for array subscript
wire.cpp:37:10: error: invalid types 'int[int]' for array subscript
wire.cpp:12:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
wire.cpp:15:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]