제출 #990726

#제출 시각아이디문제언어결과실행 시간메모리
990726Khanhcsp2세 명의 친구들 (BOI14_friends)C++14
0 / 100
11 ms7260 KiB
#include <bits/stdc++.h> #define el '\n' #define fi first #define sc second #define int ll #define pii pair<int, int> #define all(v) v.begin(), v.end() using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; const int mod=1e9+7; const int N=1e5+11; string s, s1="", s2=""; int n; void sol() { cin >> n >> s; s=" "+s; if(n%2==0) { cout << "NOT POSSIBLE"; return; } else { int i=1, j=n/2+2, ans=0, ch=0; // cout << s[i] << ' ' << s[j] << el; while(i<=n/2+1) { if(ch==2) break; if(s[i]==s[j]) s1+=s[i], i++, j++; else i++, ch++; } if(ch<=1) ans++; // cout << s1 << el; i=1, j=n/2+1, ch=0; while(i<=n/2) { if(ch==2) break; if(s[i]==s[j]) s2+=s[j], i++, j++; else j++, ch++; } string ss=s1; if(s2.size()==n/2) ss=s2; if(ch<=1) ans++; if(ans==0) cout << "NOT POSSIBLE"; else if(ans==1) cout << ss; else cout << "NOT UNIQUE"; } } signed main() { // freopen("divisor.INP", "r", stdin); // freopen("divisor.OUT", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); int t=1; //cin >> t; while(t--) { sol(); } }

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

friends.cpp: In function 'void sol()':
friends.cpp:45:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   45 |         if(s2.size()==n/2) ss=s2;
      |            ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...