CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:Tipu
Submission time:2022-10-31 10:00:34 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#1ACCEPTED0.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:13:10: warning: unused variable 'in' [-Wunused-variable]
   13 |     bool in = false;
      |          ^~
input/code.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
using namespace std::chrono;
int main(){
    freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n;
    cin >> m;

    int a = 0;
    bool in = false;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        if(s.find('*') == s.npos){
            continue;
        }
        bool jn = false;
        for (int j = 0; j < m; j++)
        {
            if(s[j] == '*' && jn == true){
                // cout << s[j] << "(" << i << "," << j << ")";
                break;
            }
            if(s[j] == '*' && jn == false){
                jn = true;
            }
           
            if(jn && s[j] == '@'){
                a += 1;
            }
        }
        
     
        
    }
    cout << a;

}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

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

correct output
0

user output
0

Test 2

Group: 1, 2

Verdict:

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

correct output
1

user output
0

Test 3

Group: 1, 2

Verdict:

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

correct output
4

user output
0

Test 4

Group: 1, 2

Verdict:

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

correct output
11

user output
0

Test 5

Group: 1, 2

Verdict:

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

correct output
64

user output
0

Test 6

Group: 2

Verdict:

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

correct output
60

user output
0

Test 7

Group: 2

Verdict:

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

correct output
1507

user output
0

Test 8

Group: 2

Verdict:

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

correct output
3348

user output
0

Test 9

Group: 2

Verdict:

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

correct output
7225

user output
0