CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:erhuht
Submission time:2022-11-02 22:41:43 +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:30:38: warning: 'count' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         if (inside && c == '@') count++;
      |                                 ~~~~~^~

Code

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

int main()
{
    char c;
    int count;
    bool inside = false;
    bool last = false;
    
    int n;
    int m;
    cin >> n >> m;
    
    string line;
    do {
        cin >> line;
    }  while (line.find("*") == std::string::npos);

    while (true)
    {
        cin.get(c);
        if (c == '*')
        {
            if (last) break;
            inside = !inside;
            last = true;
        } else last = false;
        if (inside && c == '@') count++;
    }
    cout << count << "\n";
}

Test details

Test 1

Group: 1, 2

Verdict:

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

correct output
0

user output
1431665992

Test 2

Group: 1, 2

Verdict:

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

correct output
1

user output
1431665993

Test 3

Group: 1, 2

Verdict:

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

correct output
4

user output
1431665996

Test 4

Group: 1, 2

Verdict:

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

correct output
11

user output
1431666003

Test 5

Group: 1, 2

Verdict:

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

correct output
64

user output
1431666056

Test 6

Group: 2

Verdict:

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

correct output
60

user output
1431666052

Test 7

Group: 2

Verdict:

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

correct output
1507

user output
1431667499

Test 8

Group: 2

Verdict:

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

correct output
3348

user output
1431669340

Test 9

Group: 2

Verdict:

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

correct output
7225

user output
1431673217