제출 #1337748

#제출 시각아이디문제언어결과실행 시간메모리
1337748nguyengiabach1201BOI Acronym (BOI25_boi)C++20
0 / 100
2 ms836 KiB
// https://oj.uz/problem/view/BOI25_boi

#include <bits/stdc++.h>

using namespace std;

#define el '\n'
#define FNAME ""
#define ll long long
#define int long long
#define ld long double

const int MOD = 1e9 + 7;
const ll INF = 1e18 + 7;
const double EPS = 1e-9;

void setup()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    if (fopen(FNAME ".inp", "r"))
    {
        freopen(FNAME ".inp", "r", stdin);
        freopen(FNAME ".out", "w", stdout);
    }

    return;
}

const int N = 2e3 + 5;
int n, m[N][N];

void solve()
{
    cin >> n;

    for (int i = 1; i <= n; ++i)
        for (int j = i; j <= n; ++j)
            cin >> m[i][j];

    vector<int> ans;

    vector<int> prefB(n + 5);

    for (int i = 1; i <= n; ++i)
    {
        bool ok = true;
        prefB[i] = prefB[i - 1] + 1;

        for (int l = 1; l <= i; ++l)
            if (i - l + 1 - 2 * m[l][i] > prefB[i] - prefB[l - 1] || prefB[i] - prefB[l - 1] > m[l][i])
            {
                ok = false;
                break;
            }

        if (!ok)
            prefB[i] = prefB[i - 1];
    }

    // for (int i = 1; i <= n; ++i)
    //     cerr << prefB[i] << " ";
    // cerr << el;

    for (int i = 1; i <= n; ++i)
        if (prefB[i] != prefB[i - 1])
            ans.push_back(i);

    // sort(ans.begin(), ans.end());

    for (int i : ans)
        cout << i << " ";
    cout << el;

    return;
}

signed main()
{
    setup();

    int t = 1;
    bool multiTest = false;

    if (multiTest)
        cin >> t;

    while (t--)
        solve();

    return 0;
}

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

Main.cpp: In function 'void setup()':
Main.cpp:24:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         freopen(FNAME ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Main.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(FNAME ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...