Submission #457702

# Submission time Handle Problem Language Result Execution time Memory
457702 2021-08-07T10:00:57 Z jurgis Coins (LMIO19_monetos) C++14
0 / 100
2000 ms 1012 KB
#include <iostream>
#include <bits/stdc++.h>
#define turbo() std::ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
    int t; cin>>t;
    for(int i=0; i<t; i++){
        int n; cin>>n; int plac[n][n]; int k1, k2; cin>>k1>>k2; long long cnt = 0;
        for(int a=0; a< n; a++){
            for(int b=0; b<n; b++){

                int c;
                cin>>c;
                if(a>=b){

                    plac[a][b] = 1;
                }else{
                    plac[a][b]= 0;
                }

            }
        }
        for(int a=0; a< n; a++){
            if(plac[a][a] ==1){
                cnt++;
            }
        }
        if(cnt<n/2){
            for(int a=n-1; a>=n-cnt;){
                if(plac[a][a]==0){
                    plac[a][a] = 1; a++;
                }
            }
        }
        else{
            for(int a=n-1; a>=n-cnt;){
                if(plac[a][a]==1){
                    plac[a][a] = 0; a++;
                }
            }
        }
        for(int a = 0; a< n; a++){
            for(int b =0 ; b< n; b++){
                cout<<plac[a][b]<< " ";
            }
            cout<<"\n";
        }

    }
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 204 KB Time limit exceeded
2 Execution timed out 2071 ms 204 KB Time limit exceeded
3 Execution timed out 2083 ms 588 KB Time limit exceeded
4 Execution timed out 2066 ms 588 KB Time limit exceeded
5 Execution timed out 2077 ms 588 KB Time limit exceeded
6 Runtime error 17 ms 1012 KB Execution killed with signal 11
7 Execution timed out 2087 ms 588 KB Time limit exceeded
8 Execution timed out 2083 ms 588 KB Time limit exceeded
9 Execution timed out 2051 ms 712 KB Time limit exceeded
10 Execution timed out 2086 ms 588 KB Time limit exceeded