제출 #1111797

#제출 시각아이디문제언어결과실행 시간메모리
1111797ThegeekKnight16세 명의 친구들 (BOI14_friends)C++17
0 / 100
1061 ms9660 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tam;
    cin >> tam;
    if (tam % 2 == 0) {cout << "NOT POSSIBLE" << '\n'; return 0;}
    int N = (tam-1)/2;

    string S; cin >> S;
    int resp = -1;
    for (int r = 0; r < tam; r++)
    {
        string S2 = "";
        for (int i = 0; i < tam; i++) if (i != r) S2 += S[i];

        bool ok = 1;
        for (int i = 0; i < N; i++) if (S2[i] != S2[i+N]) {ok = 0; break;}

        if (ok && resp == -1) resp = r;
        else if (ok) {cout << "NOT UNIQUE" << '\n'; return 0;}
    }

    if (resp == -1) {cout << "NOT POSSIBLE" << '\n'; return 0;}

    int cnt = 0;
    for (int i = 0; cnt < N; i++) if (i != resp) {cout << S[i]; cnt++;} cout << '\n';
}

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

friends.cpp: In function 'int main()':
friends.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |     for (int i = 0; cnt < N; i++) if (i != resp) {cout << S[i]; cnt++;} cout << '\n';
      |     ^~~
friends.cpp:30:73: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |     for (int i = 0; cnt < N; i++) if (i != resp) {cout << S[i]; cnt++;} cout << '\n';
      |                                                                         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...