QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549699#7120. SoccerthangthangCompile Error//C++202.1kb2024-09-06 19:44:052024-09-06 19:44:06

Judging History

你现在查看的是最新测评结果

  • [2024-09-06 19:44:06]
  • 评测
  • [2024-09-06 19:44:05]
  • 提交

answer

// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int MaxN = 2e5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

int biggest_stadium(int n, vector <vi> f){
//    if (n > 30){
        int ans = 0;
        vi l(n, -1), r(n, -1);
        int st = -1, ed = n, gg = 0;
        for (int i = 0; i < n; ++ i){
            //cout << i << endl;
            int nt = 0;
            for (int j = 0; j < n; ++ j) {
                if (!f[i][j]){
                    if (l[i] == -1) l[i] = j;
                    r[i] = j; ++ ans; gg = 1;
                    if (st == -1) st = i; if (i > ed) return 0;
                    if (nt) return 0;
                }
                else if (l[i] != -1) nt = 1;
            }
            if (l[i] == -1 && gg && ed == n) ed = i;
        }
        for (int i = st; i < ed; ++ i){
            for (int j = i + 1; j < ed; ++ j){
                if (l[i] <= l[j] && r[j] <= r[i]) continue;
                if (l[j] <= l[i] && r[i] <= r[j]) continue;
                return 0;
            }
        }
        int h = 0;
        for (int i = st + 1; i < ed; ++ i){
            int j = i - 1;
                if (l[i] <= l[j] && r[j] <= r[i] && h == 0) continue;
                h = 1;
                if (l[j] <= l[i] && r[i] <= r[j] && h == 1) continue;
                return 0;
        }

        return ans;
    //}
}

void solve(){
    int n; cin >> n;
    vector <vi> f(n);
    for (int i = 0; i < n; ++ i) for (int j = 0, a; j < n; ++ j){
        cin >> a;
        f[i].pb(a);
    }
    cout << biggest_stadium(n, f) << endl;
}

int main(){
    if (fopen("pqh.inp", "r")){
        freopen("pqh.inp", "r", stdin);
        freopen("pqh.out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1; // cin >> t;
    while (t --) solve();
    return 0;
}


Details

answer.code: In function ‘int main()’:
answer.code:72:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   72 |         freopen("pqh.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
answer.code:73:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   73 |         freopen("pqh.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc3CQW5N.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccnOOdnQ.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status