제출 #735667

#제출 시각아이디문제언어결과실행 시간메모리
735667josanneo22세 명의 친구들 (BOI14_friends)C++17
100 / 100
14 ms6148 KiB
#include<stdio.h> int n; char a[2001000]; char b[2001000]; int main(){ int i,t,flag; scanf("%d",&n); scanf("%s",a); if(n%2==0){ puts("NOT POSSIBLE"); return 0; } for(i=0;i<n/2;i++){ if(a[i]!=a[i+n/2])break; } t=i; for(i=n/2-1;i>=0;i--){ if(a[i]!=a[i+n/2+1])break; } if(t>i)flag=1; else flag=0; for(i=0;i<n/2+1;i++){ if(a[i]!=a[i+n/2+1])break; } t=i; for(i=n/2;i>=0;i--){ if(a[i]!=a[i+n/2])break; } if(t>=i){ if(flag==1){ for(i=0;i<n/2;i++){ if(a[i]!=a[i+n/2+1])break; } if(i==n/2){ for(i=0;i<n/2;i++){ b[i]=a[i]; } puts(b); } else{ puts("NOT UNIQUE"); } } else{ for(i=0;i<n/2;i++){ b[i]=a[i+n/2+1]; } puts(b); } } else{ if(flag==1){ for(i=0;i<n/2;i++){ b[i]=a[i]; } puts(b); } else{ puts("NOT POSSIBLE"); } } }

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

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