Submission #457411

# Submission time Handle Problem Language Result Execution time Memory
457411 2021-08-07T07:11:24 Z Kipras Coins (LMIO19_monetos) C++17
5.3373 / 100
44 ms 608 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{

    int t, n, k, k2, top, left, temp;

    cin>>t>>n>>k>>k2;

    for(int i = 1; i <= n; i++){
        for(int x = 1; x <= n; x++){
            cin>>temp;
            if(i<=n/2&&!temp){
                top++;
            }else if(x<=n/2&&!temp){
                left++;
            }
        }
    }

    if(top>left){
        for(int i = 1; i <= n/2; i++){
            for(int x = 1; x <= n; x++){
                cout<<0<<" ";
            }
            cout<<'\n';
        }
        for(int i = n/2+1; i <= n; i++){
            for(int x = 1; x <= n; x++){
                cout<<1<<" ";
            }
            cout<<'\n';
        }
    }else{
        for(int i = 1; i <= n; i++){
            for(int x = 1; x <= n/2; x++){
                cout<<0<<" ";
            }
            for(int x = n/2+1; x <= n; x++){
                cout<<1<<" ";
            }
            cout<<'\n';
        }
    }

    return 0;
}

Compilation message

monetos.cpp: In function 'int main()':
monetos.cpp:23:5: warning: 'top' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |     if(top>left){
      |     ^~
monetos.cpp:23:5: warning: 'left' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB K = 24
2 Incorrect 1 ms 204 KB K = 623
3 Partially correct 26 ms 608 KB K = 20313
4 Partially correct 25 ms 592 KB K = 23205
5 Incorrect 27 ms 524 KB K = 21462
6 Partially correct 44 ms 548 KB K = 22330
7 Partially correct 34 ms 584 KB K = 22537
8 Incorrect 28 ms 580 KB K = 25631
9 Incorrect 33 ms 584 KB K = 22541
10 Partially correct 26 ms 588 KB K = 22367