# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008341 | 2024-06-26T09:38:08 Z | Amr | Soccer Stadium (IOI23_soccer) | C++17 | 2 ms | 1628 KB |
#include "soccer.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; using namespace std; #define F first #define S second #define sz size() #define all(x) (x).begin(), (x).end() const int N = 32; ll n; vector<vector<int> > a; ll dp[N][N][N][2]; ll pre[N][N]; int biggest_stadium(int N, std::vector<std::vector<int>> F) { n = N, a = F; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) pre[i][j] = pre[i][j-1]+a[i-1][j-1]; //for(int i = 1; i <= n; i++) {for(int j = 1; j <= n;j++) cout << pre[i][j] << " "; cout << endl;} // base case ll best = 0; for(int u = 1; u <= n; u++) for(int v = u; v <= n; v++){ for(int r = 1; r <= n ;r++) for(int i = 1; i <= n; i++) for(int j = 1; j <= n ;j++) dp[r][i][j][0] = dp[r][i][j][2] = 0; for(int r = 1; r <= n; r++) for(int i = 1; i <= n; i++) for(int j = i; j <= n ;j++) { if(i>u||j<v) continue; ll cnt = pre[r][j]-pre[r][i-1]; if(cnt>0) continue; dp[r][i][j][0] = j-i+1; dp[r][i][j][1] = j-i+1; // cout << dp[1][i][j][0] << " "; } for(int r = 2; r<= n; r++) for(int i2 = 1; i2 <= n; i2++) { for(int j2 = i2; j2 <= n; j2++) { if(i2>u||j2<v) continue; ll cnt = pre[r-1][j2]-pre[r-1][i2-1]; if(cnt>0) continue; for(int i = 1; i <= n; i++) { for(int j =i ; j <= n; j++) { if(i>u||j<v) continue; cnt = pre[r][j]-pre[r][i-1]; if(cnt>0) continue; // if(i==2&&j==5&&r==2&&i2==1&&j2==5) cout << dp[r-1][i2][j2][0] << endl; if(i2>=i&&j2<=j) // prev is sub from me {dp[r][i][j][0] = max(dp[r][i][j][0],dp[r-1][i2][j2][0]+j-i+1); dp[r][i][j][1] = max(dp[r][i][j][1],dp[r-1][i2][j2][0]+j-i+1); } if(i2<=i&&j2>=j) dp[r][i][j][1] = max({dp[r][i][j][1],dp[r-1][i2][j2][0]+j-i+1,dp[r-1][i2][j2][1]+j-i+1}); } } } } // cout << dp[2][3][4][1] << endl; for(int r = 1; r <= n; r++) for(int i = 1; i <= n; i++) { for(int j = i; j <= n; j++) { if(i>u||j<v) continue; best = max({best,dp[r][i][j][0],dp[r][i][j][1]}); } //if(dp[r][i][j][1]==21) cout<<r << i << " " << j << endl; } } return best; } /* 5 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
2 | Correct | 0 ms | 348 KB | ok |
3 | Correct | 0 ms | 348 KB | ok |
4 | Correct | 1 ms | 348 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Runtime error | 2 ms | 1628 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
2 | Correct | 0 ms | 348 KB | ok |
3 | Correct | 0 ms | 348 KB | ok |
4 | Correct | 0 ms | 348 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Incorrect | 0 ms | 348 KB | wrong |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
2 | Correct | 0 ms | 348 KB | ok |
3 | Correct | 0 ms | 348 KB | ok |
4 | Correct | 0 ms | 348 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Correct | 0 ms | 348 KB | ok |
8 | Incorrect | 0 ms | 348 KB | wrong |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
2 | Correct | 0 ms | 348 KB | ok |
3 | Correct | 0 ms | 348 KB | ok |
4 | Correct | 0 ms | 348 KB | ok |
5 | Correct | 1 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Correct | 0 ms | 348 KB | ok |
8 | Correct | 0 ms | 348 KB | ok |
9 | Correct | 0 ms | 348 KB | ok |
10 | Incorrect | 0 ms | 348 KB | wrong |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
2 | Correct | 0 ms | 348 KB | ok |
3 | Correct | 0 ms | 348 KB | ok |
4 | Correct | 0 ms | 348 KB | ok |
5 | Correct | 1 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Correct | 0 ms | 348 KB | ok |
8 | Correct | 0 ms | 348 KB | ok |
9 | Correct | 0 ms | 348 KB | ok |
10 | Incorrect | 0 ms | 348 KB | wrong |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | ok |
2 | Correct | 0 ms | 348 KB | ok |
3 | Correct | 0 ms | 348 KB | ok |
4 | Correct | 0 ms | 348 KB | ok |
5 | Correct | 1 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Correct | 0 ms | 348 KB | ok |
8 | Runtime error | 2 ms | 1628 KB | Execution killed with signal 11 |
9 | Halted | 0 ms | 0 KB | - |