제출 #432351

#제출 시각아이디문제언어결과실행 시간메모리
432351cpp219세 명의 친구들 (BOI14_friends)C++14
100 / 100
35 ms10052 KiB
#pragma GCC optimization "O2" #pragma GCC optimization "unroll-loop" #pragma GCC target ("avx2") #include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second using namespace std; const ll N = 2e6 + 9; const ll mod = 1e9 + 7; const ll base = 31; typedef pair<ll,ll> LL; string s; string p,q; vector<string> ans; ll n; int main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define task "tst" if (fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); //freopen(task".out", "w", stdout); } cin>>n>>s; s = " " + s; if (n%2 == 0) return cout<<"NOT POSSIBLE",0; /// X to head ll pos = 1; while(pos <= n/2 && s[pos] == s[pos + n/2]) pos++; for(ll i = 1;i <= n/2;i++) p += s[i]; for (ll i = n/2 + 1;i <= n;i++) if (i != pos + n/2) q += s[i]; if (p == q) ans.push_back(p); p = ""; q = ""; pos = 1; while(pos <= n/2&&s[pos] == s[pos + 1 + n/2]) pos++; for(ll i = 1;i <= n/2 + 1;i++) if (i != pos) p += s[i]; for (ll i = n/2 + 2;i <= n;i++) q += s[i]; if (p == q) ans.push_back(p); if (!ans.size()) cout<<"NOT POSSIBLE"; else if (ans.size() == 1) cout<<ans[0]; else{ if (ans[0] != ans[1]) cout<<"NOT UNIQUE"; else cout<<ans[0]; } }

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

friends.cpp:1: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    1 | #pragma GCC optimization "O2"
      | 
friends.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization "unroll-loop"
      | 
friends.cpp: In function 'int main()':
friends.cpp:25:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...