| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 705511 | BidoTeima | 과수원 (NOI14_orchard) | C++17 | 129 ms | 17896 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
ID: BidoTeima
LANG: C++11
TASK:
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void moo(string filename);
void ACPLS(string str = "")
{
if(str=="NOF")return;
if(str.size() && str != "IIOT")
moo(str);
else if(str != "IIOT"){
#ifndef ONLINE_JUDGE
freopen("output.txt", "w", stdout);
freopen("input.txt", "r", stdin);
#endif
}
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void moo(string fileName){
freopen((fileName+".in").c_str(),"r",stdin);
freopen((fileName+".out").c_str(),"w",stdout);
}
#define tc \
int tttttt/*,subtask*/; \
cin >> tttttt/* >> subtask*/; \
while (tttttt--)/*end
*/
int main()
{
ACPLS("IIOT");
int n,m;
cin>>n>>m;
int a[n+1][m+1]={0};
int total = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
char ch;
cin>>ch;
a[i][j]=ch-'0';
total += a[i][j];
}
}
int colsum[n + 1][m + 1]={0};
for(int j = 1; j <= m; j++){
for(int i = 1; i <= n; i++){
colsum[i][j] = colsum[i - 1][j] + a[i][j];
}
}
int ans = 1e9;
for(int a = 1; a <= n; a++){
for(int x = a; x <= n; x++){
int mn = 0;
int cursum = 0;
for(int i = 1; i <= m; i++){
cursum += colsum[x][i] - colsum[a - 1][i];
ans = min(ans, total + i * (x - a + 1) - 2 * cursum + mn);
mn = min(mn, 2 * cursum - i * (x - a + 1));
}
}
}
cout << ans << '\n';
}
컴파일 시 표준 에러 (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... | ||||
