# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
741770 | MODDI | Poi (IOI09_poi) | C++14 | 587 ms | 23852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n, t, k;
int mat[2001][2001];
struct state{
int points;
int cnt_solved;
int id;
};
bool comp(state& a, state& b){
if(a.points < b.points) return true;
else if(a.points > b.points) return false;
else{
if(a.cnt_solved > b.cnt_solved) return false;
else if(a.cnt_solved < b.cnt_solved) return true;
else{
if(a.id < b.id) return true;
return false;
}
}
}
int main(){
cin>>n>>t>>k;
k--;
for(int i = 0; i < n; i++)
for(int j = 0; j < t; j++)
cin>>mat[i][j];
int solved[t];
memset(solved, 0, sizeof solved);
for(int j = 0; j < t; j++){
for(int i = 0; i < n; i++){
solved[j] += mat[i][j];
}
}
int points[t];
for(int j = 0; j < t; j++)
points[j] = n - solved[j];
vector<state> arr;
for(int i = 0; i < n; i++){
int cnt = 0, pts = 0;
for(int j = 0; j < t; j++){
if(mat[i][j] == 1){
cnt++;
pts += points[j];
}
}
state now;
now.cnt_solved = cnt;
now.points = pts;
now.id = i;
arr.pb(now);
}
sort(arr.begin(), arr.end(), comp);
for(int i = 0; i < n; i++){
if(arr[i].id == k){
cout<<arr[i].points<<" "<<i+1<<endl;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |