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