Submission #1072302

#TimeUsernameProblemLanguageResultExecution timeMemory
1072302ZicrusSoccer Stadium (IOI23_soccer)C++17
13.50 / 100
4595 ms596 KiB
#include <bits/stdc++.h> #include "soccer.h" using namespace std; typedef long long ll; int n; vector<vector<int>> f; vector<vector<int>> sum; int search(vector<pair<int, int>> prev, int res, int mn, int mx, bool dec) { if (sum[prev.size()][mx+1] - sum[prev.size()][mn] > 0) return res; for (auto &e : prev) { if (e.first == -1) continue; if (mn < e.first && mx < e.second) return res; if (mn > e.first && mx > e.second) return res; } prev.push_back({mn, mx}); res += mx - mn + 1; int best = res; if (prev.size() == n) return best; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { if (dec && (i < mn || j > mx)) continue; bool d = dec || i > mn || j < mx; best = max(best, search(prev, res, i, j, d)); } } return best; } int biggest_stadium(int N, vector<vector<int>> F) { n = N; f = F; sum = vector<vector<int>>(n, vector<int>(n+1)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { sum[i][j+1] = sum[i][j] + f[i][j]; } } vector<pair<int, int>> prev; int start = 0; while (sum[start].back() == n) { start++; prev.push_back({-1, -1}); } int best = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { best = max(best, search(prev, 0, i, j, false)); } } return best; }

Compilation message (stderr)

soccer.cpp: In function 'int search(std::vector<std::pair<int, int> >, int, int, int, bool)':
soccer.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     if (prev.size() == n)
      |         ~~~~~~~~~~~~^~~~
#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...