Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- int k, n;
- ifstream fin("gymnastics.in");
- ofstream fout("gymnastics.out");
- fin>>k>>n;
- int grid[n + 1][n + 1];
- for(int i = 0; i < n +1; i++){
- for(int y = 0; y < n + 1; y++){
- grid[i][y] = 0;
- }
- }
- for(int i = 0; i < n; i++){
- int arr[k];
- for(int a = 0; a < k; a++){
- fin>>arr[a];
- }
- for(int l = 0; l < n; l++){
- for(int j = l + 1; j < n; j++){
- grid[arr[l]][arr[j]]++;
- }
- }
- }
- int ans=0;
- for(int x=0;x<n + 1;x++){
- for(int y=0;y<n+1;y++){
- if(grid[x][y] == k) ans++;
- }
- }
- fout<<ans<<"\n";
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment