Submission #239127

#TimeUsernameProblemLanguageResultExecution timeMemory
239127T0p_Poi (IOI09_poi)C++14
100 / 100
425 ms24144 KiB
 #include<bits/stdc++.h>
 using namespace std;
 
 struct DATA
 {
 	int score, num, no;
 	bool operator < (const DATA & o) const{
 		return (score != o.score) ? score < o.score : ((num != o.num) ? num < o.num : no > o.no);
 	}
 };

 int result[2020][2020], score[2020], point[2020], sum[2020];
 priority_queue<DATA> heap;

 int main()
 {
 	int n, t, p;
 	scanf(" %d %d %d",&n,&t,&p);
 	for(int i=1 ; i<=t ; i++) score[i] = n;
 	for(int i=1 ; i<=n ; i++)
 		for(int j=1 ; j<=t ; j++)
 		{
 			scanf(" %d",&result[i][j]);
 			score[j] -= result[i][j];
 		}
 	for(int i=1 ; i<=n ; i++)
 		for(int j=1 ; j<=t ; j++)
 		{
 			point[i] += score[j] * result[i][j];
 			sum[i] += result[i][j];
 		}
 	for(int i=1 ; i<=n ; i++)
 		heap.push({point[i], sum[i], i});
 	for(int i=1 ; i<=n ; i++)
 	{
 		if(heap.top().no == p)
 		{
 			printf("%d %d\n",heap.top().score, i);
 			return 0;
 		}
 		heap.pop();
 	}
 	return 0;
 }

Compilation message (stderr)

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