Submission #659808

# Submission time Handle Problem Language Result Execution time Memory
659808 2022-11-19T09:49:22 Z Gabi88 Poi (IOI09_poi) C++14
60 / 100
497 ms 31916 KB
#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define F first
#define S second

vector<pair<LL, pair<LL, LL> > > v;
unsigned LL n, m, k, l[2009][2009], rj[2009], na[2009], sum, usp = -1, pos = -1, br = 1;

int main(){
	cin >> n >> m >> k;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >> l[i][j];
			na[i] += l[i][j];
			rj[j] += (l[i][j]+1)%2;
		}
	}
	for(int i=0; i<n; i++){
		sum = 0;
		for(int j=0; j<m; j++) sum += rj[j]*l[i][j];
		v.push_back(make_pair(sum, make_pair(na[i], i+1)));
	}
	sort(v.begin(), v.end());
	sum = -1;
	for(int i=n-1; i >= 0; i--){
		if (sum != v[i].first or usp != v[i].second.first){
			sum = v[i].first;
			usp = v[i].second.first;
			pos = br;
		}
		if (v[i].second.second == k){cout << sum << " " << pos; return 0;}
		br++;
	}
	return 0;
}

Compilation message

poi.cpp: In function 'int main()':
poi.cpp:13:16: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   13 |  for(int i=0; i<n; i++){
      |               ~^~
poi.cpp:14:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   14 |   for(int j=0; j<m; j++){
      |                ~^~
poi.cpp:20:16: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   20 |  for(int i=0; i<n; i++){
      |               ~^~
poi.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   22 |   for(int j=0; j<m; j++) sum += rj[j]*l[i][j];
      |                ~^~
poi.cpp:28:11: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
   28 |   if (sum != v[i].first or usp != v[i].second.first){
      |       ~~~~^~~~~~~~~~~~~
poi.cpp:28:32: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
   28 |   if (sum != v[i].first or usp != v[i].second.first){
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~
poi.cpp:33:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   33 |   if (v[i].second.second == k){cout << sum << " " << pos; return 0;}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Incorrect 1 ms 596 KB Output isn't correct
8 Correct 1 ms 596 KB Output is correct
9 Incorrect 2 ms 852 KB Output isn't correct
10 Correct 6 ms 1364 KB Output is correct
11 Correct 16 ms 2388 KB Output is correct
12 Incorrect 27 ms 3872 KB Output isn't correct
13 Incorrect 78 ms 7712 KB Output isn't correct
14 Correct 114 ms 10956 KB Output is correct
15 Incorrect 198 ms 16944 KB Output isn't correct
16 Correct 207 ms 18252 KB Output is correct
17 Incorrect 304 ms 23968 KB Output isn't correct
18 Correct 341 ms 27084 KB Output is correct
19 Correct 457 ms 31916 KB Output is correct
20 Correct 497 ms 31840 KB Output is correct