제출 #742000

#제출 시각아이디문제언어결과실행 시간메모리
742000MODDI세 명의 친구들 (BOI14_friends)C++14
35 / 100
1061 ms8168 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef pair<long long, long long> pll; typedef pair<int,int> pii; typedef vector<long long> vl; typedef vector<int> vi; int n; string str; int main(){ cin>>n>>str; int cnt = 0; map<string, int> ans; string out; for(int i = 0; i < n; i++){ string l, r; int sz = n/2; for(int j = 0; j < n; j++){ if(j == i) continue; else if(l.size() < sz) l.pb(str[j]); else r.pb(str[j]); } bool ok = true; for(int j = 0; j < l.size(); j++){ if(l[j] != r[j]){ ok = false;break; } } if(ok){ if(ans[l] == 0){ // cout<<l<<endl; out = l; cnt++; ans[l] = 1; } } } if(cnt == 1){ cout<<out<<endl; } else if(cnt > 1) cout<<"NOT UNIQUE"<<endl; else cout<<"NOT POSSIBLE"<<endl; return 0; }

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

friends.cpp: In function 'int main()':
friends.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |    else if(l.size() < sz) l.pb(str[j]);
      |            ~~~~~~~~~^~~~
friends.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(int j = 0; j < l.size(); j++){
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...