제출 #41123

#제출 시각아이디문제언어결과실행 시간메모리
4112314kg세 명의 친구들 (BOI14_friends)C++11
0 / 100
84 ms20356 KiB
#include <stdio.h> #define N 2000005 int n, link[N]; char in[N]; int main(){ int scnt=0, out=0, len=0; scanf("%d %s",&n,in+1); if(n%2==0){ printf("NOT POSSIBLE"); return 0; } for(int i=2; i<=n/2+1; i++){ int j=n/2+i; scnt+=(in[i]==in[j]); link[i]=j, link[j]=i; } if(scnt==n/2) out=1; for(int i=2; i<=n; i++){ int x=i-1, y=link[i]; scnt-=(in[i]==in[y]); link[x]=y, link[y]=x; scnt+=(in[x]==in[y]); if(scnt==n/2 && out){ printf("NOT UNIQUE"); return 0; } else if(scnt==n/2) out=i; } if(!out){ printf("NOT POSSIBLE"); return 0; } for(int i=1; len<n/2; i++){ if(i==out) continue; len++, printf("%c",in[i]); } }

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

friends.cpp: In function 'int main()':
friends.cpp:9:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %s",&n,in+1);
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...