implementation task (?
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; bool adj[2002][2002]; int score[2002]; int main() { int n,t,p,x; scanf("%d %d %d",&n,&t,&p); for (int i=1;t>=i;i++) { score[i] = n; } for (int i=1;n>=i;i++) { for (int j=1;t>=j;j++) { scanf("%d",&x); adj[i][j] = x; score[j] -= adj[i][j]; } } vector< pair<pii,int> > v; for (int i=1;n>=i;i++) { int tot=0; int cnt=0; for (int j=1;t>=j;j++) { tot += adj[i][j] * score[j]; cnt += adj[i][j]; } v.push_back(make_pair(make_pair(-tot,-cnt),i)); if (i == p)printf("%d ",tot); } sort(v.begin(),v.end()); for (int i=1;n>=i;i++) { if (v[i-1].second == p) { printf("%d\n",i); return 0; } } }
沒有留言:
張貼留言