Submission #218114

#TimeUsernameProblemLanguageResultExecution timeMemory
218114kimbj0709Poi (IOI09_poi)C++17
100 / 100
841 ms17536 KiB
#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; } } }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:37:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<arr[i].size();j++){
                 ~^~~~~~~~~~~~~~
poi.cpp:44:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<vect1.size();i++){
               ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...