QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#177533 | #7120. Soccer | triple321# | Compile Error | / | / | C++20 | 4.6kb | 2023-09-13 01:50:35 | 2024-04-28 07:41:17 |
Judging History
你现在查看的是最新测评结果
- [2024-04-28 07:41:17]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-13 01:50:35]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-13 01:50:35]
- 提交
answer
#include <bits/stdc++.h>
#ifndef CYBER
#include "soccer.h"
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#define lg long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
lg dx[] = {1, 0, -1, 0};
lg dy[] = {0, 1, 0, -1}, N;
lg valid(lg i, lg j)
{
return i >= 0 && i < N && j >= 0 && j < N;
}
int biggest_stadium(int n, vector<vector<int>> f)
{
N = n;
lg pos = 1, ans = 0, sum = 0;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
ans += !f[i][j], sum += f[i][j];
vector<int> tree[n];
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(f[i][j])
{
tree[i].push_back(j);
}
}
}
for(int i = 0; i < n; i++)
{
lg bef = 0, aft = 0;
for(auto it : tree[i])
{
lg x = it;
while(x >= 0)
{
bef += !f[i][x];
x--;
}
x = it;
while(x < n)
{
aft += !f[i][x];
x++;
}
}
if(bef && aft) pos = 0;
tree[i].clear();
}
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(f[i][j])
{
tree[j].push_back(i);
}
}
}
for(int i = 0; i < n; i++)
{
lg bef = 0, aft = 0;
for(auto it : tree[i])
{
lg x = it;
while(x >= 0)
{
bef += !f[x][i];
x--;
}
x = it;
while(x < n)
{
aft += !f[x][i];
x++;
}
}
if(bef && aft) pos = 0;
}
set<lg> se[5];
//down, right, up, left
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(f[i][j]) continue;
if(i && j && f[i-1][j] && f[i][j-1])
{
auto it = se[4].lower_bound(i);
if(it != se[4].begin()) pos = 0;
}
if(i+1 < n && j && f[i+1][j] && f[i][j-1])
{
auto it = se[4].upper_bound(i);
if(it != se[4].end()) pos = 0;
}
if(i && f[i-1][j])
{
auto it = se[0].lower_bound(i);
if(it != se[0].begin()) pos = 0;
}
if(i+1 < n && f[i+1][j])
{
auto it = se[2].upper_bound(i);
if(it != se[2].end()) pos = 0;
}
if(j && f[i][j-1])
{
if(se[1].size()) pos = 0;
}
for(int k = 0; k < 4; k++)
{
lg newI = i+dx[k], newJ = j+dy[k];
if(!valid(newI, newJ)) continue;
if(f[newI][newJ])
{
se[k].insert((k%2 ? newI : newJ));
}
}
se[4].insert(i);
}
}
if(!pos) ans = 1;
if(sum == 1 && !pos)
{
int idI = 0, idJ = 0;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(f[i][j])
{
idI = i, idJ = j;
}
}
}
idI++;
idJ++;
// cout << idI << ' ' << idJ << '\n';
// cout << idI*idJ << ' ' << idJ*(n-idI+1) << ' ' << idI*(n-idJ+1) << ' ' << (n-idJ+1)*(n-idI+1) << '\n';
ans = n*n-min({idI*idJ, idJ*(n-idI+1), idI*(n-idJ+1), (n-idJ+1)*(n-idI+1)});
}
else if(n <= 3 && !pos)
{
for(int i = 0; i < (1ll << (n*n)); i++)
{
vector<array<lg, 2>> a;
for(int j = 0; j < n*n; j++)
{
if((1ll << j)&i)
{
a.push_back({j/n, j%n});
}
}
lg o = 1;
for(auto it : a)
{
if(f[it[0]][it[1]]) o = 0;
for(auto it2 : a)
{
if(it[0] == it2[0])
{
for(int j = min(it[1], it2[1]); j <= max(it[1], it2[1]); j++)
{
if(f[it[0]][j]) o = 0;
}
if(o) continue;
}
if(it[1] == it2[1])
{
for(int j = min(it[0], it2[0]); j <= max(it[0], it2[0]); j++)
{
if(f[j][it[1]]) o = 0;
}
if(o) continue;
}
lg d = 1, h = 1;
if(!f[it[0]][it2[1]])
{
for(int i = min(it[1], it2[1]); i <= max(it[1], it2[1]); i++)
{
if(f[it[0]][i]) d = 0;
}
for(int i = min(it[0], it2[0]); i <= max(it[0], it2[0]); i++)
{
if(f[i][it2[1]]) d = 0;
}
if(d) continue;
}
if(!f[it2[0]][it[1]])
{
for(int i = min(it[1], it2[1]); i <= max(it[1], it2[1]); i++)
{
if(f[it2[0]][i]) h = 0;
}
for(int i = min(it[0], it2[0]); i <= max(it[0], it2[0]); i++)
{
if(f[i][it[1]]) h = 0;
}
if(h) continue;
}
o = 0;
break;
}
}
ans = max(ans, (lg)(o*a.size()));
}
}
return ans;
}
int main()
{
fastio;
lg n;
cin >> n;
vector<vector<int>> v (n, vector<int> (n));
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
cin >> v[i][j];
}
}
cout << biggest_stadium(n, v) << '\n';
return 0;
}
Details
/usr/bin/ld: /tmp/cca4C6qJ.o: in function `main': answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwCPQaM.o:implementer.cpp:(.text.startup+0x0): first defined here collect2: error: ld returned 1 exit status