# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
218114 | kimbj0709 | Poi (IOI09_poi) | C++17 | 841 ms | 17536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<int> arr[2000];
bool comp(pair<int,int> a,pair<int,int> b){
if(a.first != b.first){
return a.first>b.first;
}
else if(a.first==b.first&&arr[a.second].size()!=arr[b.second].size()){
return arr[a.second].size()>arr[b.second].size();
}
else{
return a.second < b.second;
}
}
int main() {
int no_of_input,no_of_tasks,pos;
int input;
vector<int> tasks;
vector<pair<int,int> > vect1;
cin >> no_of_input >> no_of_tasks >> pos;
for(int i=0;i<no_of_tasks;i++){
tasks.push_back(0);
}
for(int i=0;i<no_of_input;i++){
for(int j=0;j<no_of_tasks;j++){
cin >> input;
if(input==1){
arr[i].push_back(j);
}
else{
tasks[j]++;
}
}
}
for(int i=0;i<no_of_input;i++){
int count = 0;
for(int j=0;j<arr[i].size();j++){
count += tasks[arr[i][j]];
}
vect1.push_back(make_pair(count,i));
count = 0;
}
sort(vect1.begin(),vect1.end(),comp);
for(int i=0;i<vect1.size();i++){
if(vect1[i].second == pos-1){
cout << vect1[i].first << " " << i+1;
return 0;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |