제출 #554500

#제출 시각아이디문제언어결과실행 시간메모리
554500ollel세 명의 친구들 (BOI14_friends)C++14
0 / 100
91 ms7160 KiB
using namespace std; #include <bits/stdc++.h> #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<bool> vb; typedef long long ll; int n,m; string u; int main() { cin >> n; m = (n - 1) / 2; cin >> u; int numberEqual = 0; vi cands; rep(i,1,m+1) if (u[i] == u[i + m]) numberEqual++; if (numberEqual == m) cands.pb(0); rep(skip, 1, m) { if (u[skip] == u[skip + m]) numberEqual--; if (u[skip - 1] == u[skip + m]) numberEqual++; if (numberEqual == m) cands.pb(skip); } numberEqual = 0; rep(i,0,m) if (u[i] == u[i + m + 1]) numberEqual++; if (numberEqual == m) cands.pb(m); rep(skip, m + 1, n) { if (u[skip] == u[skip - m - 1]) numberEqual--; if (u[skip - 1] == u[skip - m - 1]) numberEqual++; if (numberEqual == m) cands.pb(skip); } if (cands.size() == 0) { cout << "NOT POSSIBLE\n"; } else if (cands.size() > 1) { cout << "NOT UNIQUE\n"; } else { int ans = cands[0]; vector<char> k; int i = -1; while (k.size() < m) { i++; if (i == ans) continue; k.pb(u[i]); } rep(i,0,m) cout << k[i]; cout << endl; } }

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

friends.cpp: In function 'int main()':
friends.cpp:51:21: warning: comparison of integer expressions of different signedness: 'std::vector<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   51 |     while (k.size() < m) {
      |            ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...