제출 #1112217

#제출 시각아이디문제언어결과실행 시간메모리
1112217lucascgar세 명의 친구들 (BOI14_friends)C++17
35 / 100
1068 ms6476 KiB
#include <bits/stdc++.h> using namespace std; /* */ typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long double, long double> pdd; const int MAXN = 2e6+11; signed main(){ std::ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s; cin >> s; if (s.size()%2 == 0){ cout << "NOT POSSIBLE\n"; return 0; } vector<int> fans; int sz = n/2; // meio for (int i=0;i<n;i++){ if (i>0 && s[i] == s[i-1]){ continue; } string a, b; int j = 0; while (a.size()<sz){ if (j!=i) a.push_back(s[j]); j++; } while (b.size()<sz){ if (j!=i) b.push_back(s[j]); j++; } if (a==b) fans.push_back(i); } if (fans.empty()){ cout << "NOT POSSIBLE\n"; }else if (fans.size()>1){ cout << "NOT UNIQUE\n"; // for (auto &x:fans) cerr << x << '\n'; } else{ int x = fans.back(), q=0, j=0; while (q<sz){ if (j!=x){ cout << s[j]; q++; } j++; } cout << '\n'; } return 0; }

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

friends.cpp: In function 'int main()':
friends.cpp:39:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |         while (a.size()<sz){
      |                ~~~~~~~~^~~
friends.cpp:43:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |         while (b.size()<sz){
      |                ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...