이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define F first
#define S second
vector<pair<LL, pair<LL, int> > > v;
unsigned LL n, m, k, l[2009][2009], rj[2009], na[2009], sum, usp, pos;
int cmt(pair<LL, pair<LL, int> > a, pair<LL, pair<LL, int> > b){
if (a.F != b.F) return a.F > b.F;
if (a.S.F != b.S.F) return a.S.F > b.S.F;
return a.S.S > b.S.S;
}
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(), cmt);
for(int i=0; i < n; i++){
if (sum != v[i].F or usp != v[i].S.F or i == 0){
sum = v[i].F;
usp = v[i].S.F;
pos = i+1;
}
if (v[i].S.S == k){cout << sum << " " << pos; return 0;}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
poi.cpp: In function 'int main()':
poi.cpp:19:16: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
19 | for(int i=0; i<n; i++){
| ~^~
poi.cpp:20:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
20 | for(int j=0; j<m; j++){
| ~^~
poi.cpp:26:16: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
26 | for(int i=0; i<n; i++){
| ~^~
poi.cpp:28:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
28 | for(int j=0; j<m; j++) sum += rj[j]*l[i][j];
| ~^~
poi.cpp:32:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
32 | for(int i=0; i < n; i++){
| ~~^~~
poi.cpp:33:11: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
33 | if (sum != v[i].F or usp != v[i].S.F or i == 0){
| ^
poi.cpp:33:28: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
33 | if (sum != v[i].F or usp != v[i].S.F or i == 0){
| ^
poi.cpp:38:16: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
38 | if (v[i].S.S == k){cout << sum << " " << pos; return 0;}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |