제출 #375255

#제출 시각아이디문제언어결과실행 시간메모리
375255daniel920712Naan (JOI19_naan)C++14
5 / 100
1 ms492 KiB
#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,z,x3,y3; 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++) { x3=1; y3=1; while(1) { x2=x1*y3+x3*y1*all[tt[now]][i]; y2=y1*y3; //printf("%lld %lld %lld %lld %lld\n",x2,y2,i,x3,y3); if(x2*N>=sum[tt[now]][M-1]*y2) { //printf("aa %lld %lld %lld\n",i,x3,y3); //printf("%lld %lld %lld %lld\n",i,now,x1,y1); x2=sum[tt[now]][M-1]*y1-x1*N; y2=y1*N*all[tt[now]][i]; //printf("%lld %lld %lld %lld\n",i,now,x2,y2); x3=x3*y2-x2*y3; y3*=y2; if(now<=N-1) { if(now<N-1) ans.push_back(make_pair(x2+i*y2,y2)); now++; y1=y3; x1=x3*all[tt[now]][i]; //printf("bb %lld %lld\n",x2,y2); } if(now==N) break; } else { x1=x2; y1=y2; break; } } if(now==N) break; } 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) 메시지

naan.cpp: In function 'int main()':
naan.cpp:15:19: warning: unused variable 'a' [-Wunused-variable]
   15 |     long long N,M,a,b,x1,y1,x2,y2,c,i,j,ok=1,now=0,z,x3,y3;
      |                   ^
naan.cpp:15:21: warning: unused variable 'b' [-Wunused-variable]
   15 |     long long N,M,a,b,x1,y1,x2,y2,c,i,j,ok=1,now=0,z,x3,y3;
      |                     ^
naan.cpp:15:35: warning: unused variable 'c' [-Wunused-variable]
   15 |     long long N,M,a,b,x1,y1,x2,y2,c,i,j,ok=1,now=0,z,x3,y3;
      |                                   ^
naan.cpp:15:41: warning: unused variable 'ok' [-Wunused-variable]
   15 |     long long N,M,a,b,x1,y1,x2,y2,c,i,j,ok=1,now=0,z,x3,y3;
      |                                         ^~
naan.cpp:15:52: warning: unused variable 'z' [-Wunused-variable]
   15 |     long long N,M,a,b,x1,y1,x2,y2,c,i,j,ok=1,now=0,z,x3,y3;
      |                                                    ^
naan.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%lld %lld",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
naan.cpp:22:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |             scanf("%lld",&all[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...