CSES - COCI 2007/2008 #1 - Results
Submission details
Task:Peg
Sender:untokarila
Submission time:2019-07-29 14:04:28 +0300
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails

Code

#include <iostream>

using namespace std;

char d[7][7];

bool diff(char a, char b){
    return (a == '.' && b == 'o') || (b == '.' && a == 'o');
}

int main(){

    for(int i=0; i<7; i++){
        for(int j=0; j<7; j++){
            if((i<2 || i>4) && (j<2 || j>4)) continue;
            cin >> d[i][j];
        }
    }

    int ans = 0;
    for(int i=0; i<7; i++){
        for(int j=0; j<7; j++){
            if(d[i][j] != 'o') continue;
            if(i>0 && i<6 && diff(d[i-1][j], d[i+1][j])) ans++;
            if(j>0 && j<6 && diff(d[i][j-1], d[i][j+1])) ans++;
        }
    }

    cout << ans;

    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
  o.o  
  .o.  
o.ooo.o
.oo.oo.
o.ooo.o
...

correct output
16

user output
16

Test 2

Verdict: ACCEPTED

input
  ...  
  o.o  
.ooooo.
..o.o..
.ooooo.
...

correct output
8

user output
8

Test 3

Verdict: ACCEPTED

input
  oo.  
  .oo  
.oo.oo.
o.oo.oo
oo.oo.o
...

correct output
26

user output
26

Test 4

Verdict: ACCEPTED

input
  ...  
  ..o  
.......
.......
.......
...

correct output
0

user output
0

Test 5

Verdict: ACCEPTED

input
  o.o  
  oo.  
o...o..
oo.o..o
.oo.oo.
...

correct output
13

user output
13

Test 6

Verdict: ACCEPTED

input
  .oo  
  .oo  
oo.o.oo
o......
oo.oo.o
...

correct output
11

user output
11