Task: | Lehmät |
Sender: | finnish_guy |
Submission time: | 2022-11-09 20:20:03 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.00 s | 1, 2 | details |
#2 | ACCEPTED | 0.00 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#4 | ACCEPTED | 0.00 s | 1, 2 | details |
#5 | ACCEPTED | 0.00 s | 1, 2 | details |
#6 | ACCEPTED | 0.00 s | 2 | details |
#7 | ACCEPTED | 0.00 s | 2 | details |
#8 | ACCEPTED | 0.01 s | 2 | details |
#9 | ACCEPTED | 0.00 s | 2 | details |
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:33:27: warning: 'right' may be used uninitialized in this function [-Wmaybe-uninitialized] 33 | if(j>left && j<right && vec[i][j]==*"@"){ | ~^~~~~~ input/code.cpp:33:17: warning: 'left' may be used uninitialized in this function [-Wmaybe-uninitialized] 33 | 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; count2 +=1; } if((bord==*"*") && mid != bord && row==i){ right=j; } if(j>left && j<right && vec[i][j]==*"@"){ count +=1; } } } cout << count << "\n"; }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
3 3 *** *.* *** |
correct output |
---|
0 |
user output |
---|
0 |
Test 2
Group: 1, 2
Verdict: ACCEPTED
input |
---|
3 3 *** *@* *** |
correct output |
---|
1 |
user output |
---|
1 |
Test 3
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
5 10 ...@...... ..******.. @.*@@@@*.@ ..******.. ... |
correct output |
---|
4 |
user output |
---|
1 |
Test 4
Group: 1, 2
Verdict: ACCEPTED
input |
---|
10 10 @@...@.@@@ ..@@.@@..@ @.*******@ ..*@....*. ... |
correct output |
---|
11 |
user output |
---|
11 |
Test 5
Group: 1, 2
Verdict: ACCEPTED
input |
---|
10 10 ********** *@@@@@@@@* *@@@@@@@@* *@@@@@@@@* ... |
correct output |
---|
64 |
user output |
---|
64 |
Test 6
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 .........................@....... |
correct output |
---|
60 |
user output |
---|
60 |
Test 7
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 ..@@..........@......@....@@..... |
correct output |
---|
1507 |
user output |
---|
1507 |
Test 8
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 .@..@@..@@.@..@..@..@@..@..@..... |
correct output |
---|
3348 |
user output |
---|
3348 |
Test 9
Group: 2
Verdict: ACCEPTED
input |
---|
100 100 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... |
correct output |
---|
7225 |
user output |
---|
7225 |