Submission #930381

#TimeUsernameProblemLanguageResultExecution timeMemory
930381vjudge1Poi (IOI09_poi)C++17
100 / 100
250 ms23888 KiB
#include<cstdio> #include<algorithm> #define UP(i,a,b) for(i=a;i<=(b);++i) #define DN(i,a,b) for(i=a;i>=(b);--i) using std::sort; const int N=2e3+5; int a[N][N],score[N],n,t,p; struct node{ int sc,cnt,i; node():sc(0),cnt(0){} }b[N]; bool operator<(node a,node b){ if(a.sc!=b.sc){ return a.sc>b.sc; }else if(a.cnt!=b.cnt){ return a.cnt>b.cnt; }else{ return a.i<b.i; } } int main(){ int i,j; scanf("%d%d%d",&n,&t,&p); UP(i,1,n){ UP(j,1,t){ scanf("%d",&a[i][j]); score[j]+=!a[i][j]; b[i].cnt+=a[i][j]; } b[i].i=i; } UP(i,1,n){ UP(j,1,t){ b[i].sc+=a[i][j]*score[j]; } } sort(b+1,b+n+1); UP(i,1,n){ if(b[i].i==p){ printf("%d %d\n",b[i].sc,i); break; } } return 0; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  scanf("%d%d%d",&n,&t,&p);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
poi.cpp:29:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |    scanf("%d",&a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...