# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
898547 | jamjanek | Garden (JOI23_garden) | C++17 | 1220 ms | 12880 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int wiersz[10010];
int kolumna[10010];
bitset<10010> tab[10010];
int wys[10010];
int main()
{
int n, m, d, i, j, x, y;
scanf("%d%d%d", &n, &m, &d);
for(i=0;i<n;i++){
scanf("%d%d", &x, &y);
swap(x,y);
x = d-x-1;
wiersz[x] = 1;
kolumna[y] = 1;
wiersz[x+d] = 1;
kolumna[y+d] = 1;
}
for(i=0;i<m;i++){
scanf("%d%d", &x, &y);
swap(x,y);
x = d-x-1;
tab[x][y] = 1;
tab[x+d][y] = 1;
tab[x][y+d] = 1;
tab[x+d][y+d] = 1;
}
for(i=0;i<2*d;i++)
if(wiersz[i])
for(j=0;j<2*d;j++)
tab[i][j] = 1;
for(i=0;i<2*d;i++)
if(kolumna[i])
for(j=0;j<2*d;j++)
tab[j][i] = 1;
int wynik = d*d;
//if(d==4)while(true);
//for(i=0;i<2*d;i++){for(j=0;j<2*d;j++)printf("%d", (int)tab[i][j]);printf("\n");}
for(i=0;i<2*d;i++){
vector<pair<int,int>>KM;
KM.push_back({-1,-1});
for(j=0;j<2*d;j++){
if(tab[i][j]==1)
wys[j] = 0;
else
wys[j]++;
while(KM.back().first>=wys[j])KM.pop_back();
//printf("%d %d: %d %d\n", i, j, wys[j], (j-KM.back().second));
if(wys[j]>0)
wynik = min(wynik,(d-wys[j])*(d-(j-KM.back().second)));
KM.push_back({wys[j], j});
}
}
j = 0;
for(i=0;i<2*d;i++){
if(wiersz[i]==1)
j = 0;
else
j++;
if(j<d)
wynik = min(wynik, d*(d-j));
}
j = 0;
for(i=0;i<2*d;i++){
if(kolumna[i]==1)
j = 0;
else
j++;
if(j<d)
wynik = min(wynik, d*(d-j));
}
printf("%d\n", wynik);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |