답안 #77318

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
77318 2018-09-25T16:41:14 Z Charis02 Dango Maker (JOI18_dango_maker) C++14
0 / 100
2 ms 712 KB
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 3004
#define INF 1e9+7

using namespace std;

ll n,m,ans;
char ar[N][N];
bool vis[N][N];

bool can(pi r,pi g,pi w)
{
    if(w.first < 0 || w.first >= n || w.second < 0 || w.second >= m)
        return false;

    return (ar[r.first][r.second] == 'R' && ar[g.first][g.second] == 'G' && ar[w.first][w.second] == 'W');
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n >> m;

    rep(i,0,n)
    {
        rep(j,0,m)
        {
            cin >> ar[i][j];
        }
    }

    rep(i,0,n)
    {
        rep(j,0,m)
        {
            if(can(mp(i,j),mp(i,j+1),mp(i,j+2)))
            {
                vis[i][j] = vis[i][j+1] = vis[i][j+2] = true;
                ans++;
            }
            else if(can(mp(i,j),mp(i+1,j),mp(i+2,j)))
            {
                vis[i][j] = vis[i+1][j] = vis[i+2][j] = true;
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 616 KB Output is correct
4 Correct 2 ms 616 KB Output is correct
5 Correct 2 ms 616 KB Output is correct
6 Incorrect 2 ms 712 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 616 KB Output is correct
4 Correct 2 ms 616 KB Output is correct
5 Correct 2 ms 616 KB Output is correct
6 Incorrect 2 ms 712 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 616 KB Output is correct
4 Correct 2 ms 616 KB Output is correct
5 Correct 2 ms 616 KB Output is correct
6 Incorrect 2 ms 712 KB Output isn't correct
7 Halted 0 ms 0 KB -