Submission #1217955

#TimeUsernameProblemLanguageResultExecution timeMemory
1217955qwushaSoccer Stadium (IOI23_soccer)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h> #include "soccer.h" using namespace std; #define fi first #define se second typedef long long ll; typedef long double ld; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); ll inf = 1e18; int n; bool all_good(vector<vector<int>> f, int chi, int chj) { bool ok = 1; for (int vi = chi; vi <= chi; vi++) { for (int vj = chj; vj <= chj; vj++) { for (int ui = 0; ui < n; ui++) { for (int uj = 0; uj < n; uj++) { if (!(f[vi][vj] == 0 && f[ui][uj] == 0)) continue; int mini = min(vi, ui); int maxi = max(vi, ui); int minj = min(vj, uj); int maxj = max(vj, uj); bool fii = 1, fij = 1; for (int i = mini; i <= maxi; i++) { if (f[i][vj] == 1) fii = 0; if (f[i][uj] == 1) fij = 0; } for (int j = minj; j <= maxj; j++) { if (f[ui][j] == 1) fii = 0; if (f[vi][j] == 1) { fij = 0; } } if (fii == 0 && fij == 0) { ok = 0; } } } } } return ok; } vector<vector<int>> constr(set<pair<int, int>> st) { vector<vector<int>> vec(n, vector<int>(n, 1)); for (auto [i, j] : st) { vec[i][j] = 0; } } int biggest_stadium(int N, vector<vector<int>> f) { int res = 0; n = N; vector<set<pair<int, int>>> st, newst; set<set<pair<int, int>>> newSET; vector<pair<int, int>> emp; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (f[i][j] == 0) { set<pair<int,int>> setik = {{i, j}}; emp.push_back({i,j}); st.push_back(setik); } } } while (!st.empty()) { res++; newst.clear(); newSET.clear(); for (auto setik : st) { for (auto [ci, cj] : emp) { if (setik.find({ci, cj}) != setik.end()) { continue; } setik.insert({ci, cj}); auto vec = constr(setik); if (all_good(vec, ci, cj)) { newst.push_back(setik); } setik.erase({ci, cj}); } } for (auto el : newst) { newSET.insert(el); } st.clear(); for (auto el : newSET) { st.push_back(el); } } return res; }

Compilation message (stderr)

soccer.cpp: In function 'std::vector<std::vector<int> > constr(std::set<std::pair<int, int> >)':
soccer.cpp:57:1: warning: no return statement in function returning non-void [-Wreturn-type]
   57 | }
      | ^
#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...