# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
720669 | AnjaJ | Poi (IOI09_poi) | C++14 | 276 ms | 7996 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <cstring>
using namespace std;
struct Res{
int ID, Tasks, Points;
Res(){ID = Tasks = Points = 0;}
bool operator<(const Res &r) const{
if(Points != r.Points) return Points>r.Points;
if(Tasks != r.Tasks) return Tasks>r.Tasks;
return ID<r.ID;
}
};
int PhilID;
int Contestants;
int Tasks;
vector<Res> Results(2001);
bool T[2001][2001];
int Values[2001];
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>Contestants>>Tasks>>PhilID;
Results.resize(Contestants+1);
for(int i=1; i<=Contestants; i++)
{
Results[i].ID = i;
Results[i].Tasks = Results[i].Points = 0;
}
for(int i=1; i<=Tasks; i++)
{
Values[i] = Contestants;
}
for(int i=1; i<=Contestants; i++)
{
for(int j=1; j<=Tasks; j++)
{
cin>>T[i][j];
if(T[i][j])
{
Values[j]--;
Results[i].Tasks++;
}
}
}
for(int i=1; i<=Contestants; i++)
{
for(int j=1; j<=Tasks; j++)
{
if(T[i][j])
{
Results[i].Points += Values[j];
}
}
}
sort(Results.begin(), Results.end());
for(int i=0; i<Results.size(); i++)
{
if(Results[i].ID == PhilID)
{
cout<<Results[i].Points<<" "<<i+1<<'\n';
}
}
return 0;
/*for(int i=1; i<=Tasks; i++)
{
cout<<Values[i]<<" ";
}*/
/*cout<<endl;
for(int i=1; i<=Contestants; i++)
{
for(int t : Results[i])
{
cout<<t<<" ";
}
cout<<endl;
}*/
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |