CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:finnish_guy
Submission time:2022-11-09 20:17:25 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.00 s1, 2details
#20.00 s1, 2details
#30.00 s1, 2details
#40.00 s1, 2details
#50.00 s1, 2details
#60.00 s2details
#70.00 s2details
#80.00 s2details
#90.00 s2details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:25:47: warning: 'row' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |             if((mid ==bord) && (bord == *"*") && (row !=i)){
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
input/code.cpp:35:27: warning: 'right' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |             if(j>left && j<right && vec[i][j]==*"@"){
      |                          ~^~~~~~
input/code.cpp:35:17: warning: 'left' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |             if(j>left && j<right && vec[i][j]==*"@"){
      |                ~^~~~~

Code

#include <iostream>
#include <vector>
using namespace std;

int main(){
    int x, y, left, right, count=0, row, count2=0;
    char s;
    cin >> x >> y;
    vector<char>v;
    vector<vector<char>>vec(x,vector<char> (y));

    for(int i = 0; i < x; i++){
        for(int j = 0; j < y; j++){
            cin >> s;
            vec[i][j]=s;
        }
    }    

    for(int i = 0; i < x; i++){
        if(count2==2){break;}
        for(int j = 0; j < y; j++){
            if(count2==2){break;}
            char bord = vec[i][j];
            char mid = vec[i][j+1];
            if((mid ==bord) && (bord == *"*") && (row !=i)){
                left=j;
                row = i;
                cout << "Hi" << "\n";
                count2 +=1;
            }
            if((bord==*"*") && mid != bord && row==i){
                right=j;
                cout << "hi" << "\n";
            }
            if(j>left && j<right && vec[i][j]==*"@"){
                count +=1;
            }
        }
    }   
    cout << count << "\n";
}

Test details

Test 1

Group: 1, 2

Verdict:

input
3 3
***
*.*
***

correct output
0

user output
Hi
hi
Hi
0

Test 2

Group: 1, 2

Verdict:

input
3 3
***
*@*
***

correct output
1

user output
Hi
hi
Hi
1

Test 3

Group: 1, 2

Verdict:

input
5 10
...@......
..******..
@.*@@@@*.@
..******..
...

correct output
4

user output
Hi
hi
Hi
4

Test 4

Group: 1, 2

Verdict:

input
10 10
@@...@.@@@
..@@.@@..@
@.*******@
..*@....*.
...

correct output
11

user output
Hi
hi
Hi
11

Test 5

Group: 1, 2

Verdict:

input
10 10
**********
*@@@@@@@@*
*@@@@@@@@*
*@@@@@@@@*
...

correct output
64

user output
Hi
hi
Hi
64

Test 6

Group: 2

Verdict:

input
100 100
.........................@.......

correct output
60

user output
Hi
hi
Hi
60

Test 7

Group: 2

Verdict:

input
100 100
..@@..........@......@....@@.....

correct output
1507

user output
Hi
hi
Hi
1507

Test 8

Group: 2

Verdict:

input
100 100
.@..@@..@@.@..@..@..@@..@..@.....

correct output
3348

user output
Hi
hi
Hi
3348

Test 9

Group: 2

Verdict:

input
100 100
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...

correct output
7225

user output
Hi
hi
Hi
7225