# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
375152 | daniel920712 | Naan (JOI19_naan) | C++14 | 1 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
long long all[2005][2005];
long long sum[2005][2005]={0};
int main()
{
long long N,M,a,b,x1,x2,y1,y2,c,i,j;
scanf("%lld %lld",&N,&M);
for(i=0;i<N;i++)
{
for(j=1;j<=M;j++)
{
scanf("%lld",&all[i][j]);
sum[i][j]=sum[i][j-1]+all[i][j];
}
}
for(i=1;i<=M;i++)
{
a=sum[1][i-1];
b=all[1][i];
c=sum[1][M];
a*=2;
b*=2;
if(c-a>=0)
{
x1=c-a;
y1=b;
}
a=sum[0][M]-sum[0][i+0];
b=all[0][i];
c=sum[0][M];
a*=2;
b*=2;
if(a+b-c>=0)
{
x2=a+b-c;
y2=b;
}
if(x1*y2<=x2*y1)
{
printf("%lld %lld\n",(i-1)*y1+x1,y1);
printf("2 1\n");
return 0;
}
a=sum[0][i-1];
b=all[0][i];
c=sum[0][M];
a*=2;
b*=2;
if(c-a>=0)
{
x1=c-a;
y1=b;
}
a=sum[1][M]-sum[1][i+1];
b=all[1][i];
c=sum[1][M];
a*=2;
b*=2;
if(a+b-c>=0)
{
x2=a+b-c;
y2=b;
}
if(x1*y2<=x2*y1)
{
printf("%lld %lld\n",(i-1)*y1+x1,y1);
printf("1 2\n");
return 0;
}
}
printf("-1\n");
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... |