Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("campionat.in");
- ofstream fout("campionat.out");
- int T, N, D, scor[1001], A[1001][1001];
- int meci[1001], vmax, scormax[1001], sol[1001], da;
- int main()
- {
- int x, y, i, j;
- fin>>T;
- fin>>N;
- for(i=1; i<=N; i++)
- fin>>scor[i];
- fin>>D;
- for(i=1; i<=D; i++)
- {
- fin>>x>>y;
- A[x][y]=A[y][x]=1;
- }
- for(i=1; i<=N; ++i)
- for(j=1; j<=N; ++j)
- meci[i]+=A[i][j];
- if(T==1)
- {
- for(i=1; i<=N; ++i)
- if(scor[i]+meci[i] > vmax)
- vmax=scor[i]+meci[i];
- for(i=1; i<=N; ++i)
- if(vmax==scor[i]+meci[i])
- fout<<i<<" ";
- return 0;
- }
- for(i=1; i<=N; ++i)
- {
- scormax[i]=scor[i]+3*meci[i];
- int ok=0;
- for(j=1; j<=N; ++j)
- if(j!=i)
- {
- vmax=scor[j]+3*meci[j]-3*A[i][j];
- if(scormax[i]>vmax)
- ok++;
- }
- if(ok==N-1)
- fout<<i<<" ", da=1;
- }
- if(!da)
- fout<<0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement