Submission #20003321


Source Code Expand

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int di[] = {-1, 0, 0, 1};
int dj[] = { 0,-1, 1, 0};

int din[] = {-1, 1, -1, 1};
int djn[] = {-1,-1, 1, 1};

int main(){
    int H,W;
    cin >> H >> W;
    char M[H][W];
    REP(i,H)REP(j,W)cin >> M[i][j];
    int ans = 0;
    REP(i,H){
        REP(j,W){
            if(M[i][j] == '.')continue;
            ans += 4;
            bool flag = true;
            REP(k,4){
                int ni = i + di[k];
                int nj = j + dj[k];
                if(M[ni][nj] == '#')ans-=2;
            }
            REP(k,4){
                int ni = i + din[k];
                int nj = j + djn[k];
                if(M[ni][nj] == '#')ans++;
            }
        }
    }
    cout << ans << endl;

}

Submission Info

Submission Time
Task C - Digital Graffiti
User kiuyuki
Language C++ (GCC 9.2.1)
Score 300
Code Size 1384 Byte
Status AC
Exec Time 11 ms
Memory 3572 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:18: warning: unused variable ‘flag’ [-Wunused-variable]
   32 |             bool flag = true;
      |                  ^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 27
Set Name Test Cases
Sample sample_01.txt
All handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_03.txt, oldsample_00.txt, oldsample_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, sample_01.txt
Case Name Status Exec Time Memory
handmade_00.txt AC 11 ms 3496 KiB
handmade_01.txt AC 2 ms 3476 KiB
handmade_02.txt AC 2 ms 3496 KiB
handmade_03.txt AC 2 ms 3552 KiB
oldsample_00.txt AC 3 ms 3440 KiB
oldsample_01.txt AC 3 ms 3424 KiB
random_00.txt AC 2 ms 3472 KiB
random_01.txt AC 2 ms 3572 KiB
random_02.txt AC 2 ms 3444 KiB
random_03.txt AC 2 ms 3448 KiB
random_04.txt AC 2 ms 3440 KiB
random_05.txt AC 2 ms 3384 KiB
random_06.txt AC 3 ms 3476 KiB
random_07.txt AC 2 ms 3548 KiB
random_08.txt AC 3 ms 3500 KiB
random_09.txt AC 2 ms 3444 KiB
random_10.txt AC 2 ms 3520 KiB
random_11.txt AC 2 ms 3388 KiB
random_12.txt AC 3 ms 3420 KiB
random_13.txt AC 2 ms 3476 KiB
random_14.txt AC 2 ms 3416 KiB
random_15.txt AC 6 ms 3476 KiB
random_16.txt AC 2 ms 3444 KiB
random_17.txt AC 4 ms 3568 KiB
random_18.txt AC 2 ms 3556 KiB
random_19.txt AC 2 ms 3416 KiB
sample_01.txt AC 2 ms 3384 KiB