Submission #786039

#TimeUsernameProblemLanguageResultExecution timeMemory
786039baneThree Friends (BOI14_friends)C++17
35 / 100
1085 ms6340 KiB
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i < (n); ++i) #define rep1n(i, n) for (int i = 1; i <= (n); ++i) #define repr(i, n) for (int i = (n) - 1; i >= 0; --i) #define pb push_back #define eb emplace_back #define fr first #define mp make_pair #define sc second #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define each(x, a) for (auto &x : a) #define vec vector #define TURBO {ios::sync_with_stdio(0); cin.tie(0);} using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using str = string; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vll = vector<ll>; using vpii = vector<pair<int, int>>; using vvi = vector<vi>; void solve(){ int n, c = 0; string s; cin >> n >> s; string ans = ""; map<string,int>flag; for(int i = 0; i < n; i++){ string res = "", res2 = ""; for (int j = 0; j < n; j++){ if (i == j)continue; if (res.size() < n / 2)res += s[j]; else res2 += s[j]; } if (res == res2 && res.size() > 0){ if (flag[res])continue; flag[res] = 1; ++c; ans = res; } } if (c == 0)cout << "NOT POSSIBLE"; else if (c == 1)cout << ans; else cout << "NOT UNIQUE"; } int main(){ TURBO; int tt = 1; // cin >> tt; while(tt--){ solve(); } }

Compilation message (stderr)

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