Submission #1109352

#TimeUsernameProblemLanguageResultExecution timeMemory
1109352Nelt세 명의 친구들 (BOI14_friends)C++17
0 / 100
12 ms6388 KiB
#include <bits/stdc++.h> #define ll long long #define endl "\n" using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); void solve() { ll n; cin >> n; string s; cin >> s; if ((n + 1) & 1) { cout << "NOT POSSIBLE\n"; return; } string a = s.substr(0, n >> 1), b = s.substr(n - (n >> 1)); ll ptr = 0, ptr1 = 0; for (ll i = (n >> 1); i < n; i++) if (ptr < a.size() and s[i] == a[ptr]) ptr++; for (ll i = 0; i < n - (n >> 1); i++) if (ptr1 < b.size() and s[i] == b[ptr1]) ptr1++; if (ptr < a.size() and ptr1 < b.size()) cout << "NOT POSSIBLE\n"; else if (ptr == a.size() and ptr1 == b.size()) cout << "NOT UNIQUE\n"; else if (ptr == a.size()) cout << a << endl; else cout << b << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); ll t = 1; // precomp(); // cin >> t; for (ll i = 1; i <= t; i++) solve(); cerr << "\nTime elapsed: " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n"; }

Compilation message (stderr)

friends.cpp: In function 'void solve()':
friends.cpp:21:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if (ptr < a.size() and s[i] == a[ptr]) ptr++;
      |             ~~~~^~~~~~~~~~
friends.cpp:22:52: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for (ll i = 0; i < n - (n >> 1); i++) if (ptr1 < b.size() and s[i] == b[ptr1]) ptr1++;
      |                                               ~~~~~^~~~~~~~~~
friends.cpp:23:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if (ptr < a.size() and ptr1 < b.size()) cout << "NOT POSSIBLE\n";
      |         ~~~~^~~~~~~~~~
friends.cpp:23:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if (ptr < a.size() and ptr1 < b.size()) cout << "NOT POSSIBLE\n";
      |                            ~~~~~^~~~~~~~~~
friends.cpp:24:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     else if (ptr == a.size() and ptr1 == b.size()) cout << "NOT UNIQUE\n";
      |              ~~~~^~~~~~~~~~~
friends.cpp:24:39: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     else if (ptr == a.size() and ptr1 == b.size()) cout << "NOT UNIQUE\n";
      |                                  ~~~~~^~~~~~~~~~~
friends.cpp:25:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     else if (ptr == a.size()) cout << a << endl;
      |              ~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...