제출 #625620

#제출 시각아이디문제언어결과실행 시간메모리
625620kkkkkkkk세 명의 친구들 (BOI14_friends)C++14
0 / 100
82 ms6272 KiB
#include <iostream> using namespace std; int main() { int n; string s; cin >> n >> s; if (n%2==0) { cout << "NOT POSSIBLE" << endl; return 0; } int cnt=0,poz=-1; bool ok=true,moze=true; for (int i=0,j=n/2+1;j<n,i<=n/2;) { if (s[i]==s[j]) i++,j++; else if (s[i]!=s[j]&&ok==true) poz=i,i++,ok=false; else { moze=false; break; } } if (moze) cnt++; ok=true,moze=true; for (int i=0,j=n/2;j<n,i<n/2;) { if (s[i]==s[j]) i++,j++; else if (s[i]!=s[j]&&ok==true) { if (poz==-1) poz=j; j++,ok=false; } else { moze=false; break; } } if (moze) cnt++; if (cnt==0) cout << "NOT POSSIBLE" << endl; if (cnt==1) { //cout << poz << endl; if (poz>=n/2) { for (int i=0;i<n/2;i++) cout << s[i]; } else { for (int i=n/2+1;i<n;i++) cout << s[i]; } } else cout << "NOT UNIQUE" << endl; return 0; }

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

friends.cpp: In function 'int main()':
friends.cpp:18:27: warning: left operand of comma operator has no effect [-Wunused-value]
   18 |     for (int i=0,j=n/2+1;j<n,i<=n/2;)
      |                          ~^~
friends.cpp:33:25: warning: left operand of comma operator has no effect [-Wunused-value]
   33 |     for (int i=0,j=n/2;j<n,i<n/2;)
      |                        ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...