제출 #398844

#제출 시각아이디문제언어결과실행 시간메모리
398844almothana05세 명의 친구들 (BOI14_friends)C++14
100 / 100
14 ms5240 KiB
#include<iostream> #include<vector> #include<string> #include<string.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int menge , numm , nummer ,cmp1 , cmp2 , mit; bool kann1 = 0 , kann2 = 0; string s , s1 ,s2; cin >> menge >> s; if(menge % 2 == 0){ cout << "NOT POSSIBLE" << endl; return 0; } mit = menge /2; for(int i = 0 , j = mit + 1 ; i <= mit ; i++ ){ if(s[i] == s[j]){ j++; } if(j == menge ){ kann1 = 1; break; } } for(int i = mit , j = 0 ; i < menge ;i++){ if(s[i] == s[j]){ j++; } if(j == mit ){ kann2 = 1; break; } } s1 = s.substr(0 , mit); s2 = s.substr(mit + 1 , mit); if(kann1 == 1){ if(kann2 == 1 && s1 != s2){ cout << "NOT UNIQUE" << endl; } else{ cout << s2 << endl; } } else if(kann2 == 1){ cout << s1 << endl; } else{ cout << "NOT POSSIBLE"<< endl; } //cout << kann1 << ' ' << nu1 << "\n" << kann2 << ' ' << nu2<<"\n"; return 0; }

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

friends.cpp: In function 'int main()':
friends.cpp:9:17: warning: unused variable 'numm' [-Wunused-variable]
    9 |     int menge , numm , nummer  ,cmp1 , cmp2 , mit;
      |                 ^~~~
friends.cpp:9:24: warning: unused variable 'nummer' [-Wunused-variable]
    9 |     int menge , numm , nummer  ,cmp1 , cmp2 , mit;
      |                        ^~~~~~
friends.cpp:9:33: warning: unused variable 'cmp1' [-Wunused-variable]
    9 |     int menge , numm , nummer  ,cmp1 , cmp2 , mit;
      |                                 ^~~~
friends.cpp:9:40: warning: unused variable 'cmp2' [-Wunused-variable]
    9 |     int menge , numm , nummer  ,cmp1 , cmp2 , mit;
      |                                        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...