답안 #656274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
656274 2022-11-06T16:55:47 Z Dec0Dedd Dango Maker (JOI18_dango_maker) C++14
13 / 100
5 ms 9172 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 3e3+1;

string S = "RGW";

char c[N][N], tmp[N][N];
bool us[N][N];
int n, m;

bool ver(int i, int j) {
   if (j+2 > m) return false;
   for (int k=0; k<3; ++k) {
      if (c[i][j+k] != S[k] || us[i][j+k]) return false;
   }
   return true;
}

bool hor(int i, int j) {
   if (i+2 > n) return false;
   for (int k=0; k<3; ++k) {
      if (c[i+k][j] != S[k] || us[i+k][j]) return false;
   }
   return true;
}

int solve() {
   int ans=0;
   memset(us, false, sizeof(us));

   for (int i=1; i<=n; ++i) {
      for (int j=1; j<=m; ++j) {
         if (ver(i, j)) {
            for (int k=0; k<3; ++k) us[i][j+k]=true;
            ++ans;
         } else if (hor(i, j)) {
            for (int k=0; k<3; ++k) us[i+k][j]=true;
            ++ans;
         }
      }
   }

   return ans;
}

int main() {
   ios_base::sync_with_stdio(0);
   cin.tie(NULL);
   cout.tie(NULL);

   cin>>n>>m;
   for (int i=1; i<=n; ++i) {
      for (int j=1; j<=m; ++j) cin>>c[i][j]; 
   }
   cout<<solve()<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 9044 KB Output is correct
2 Correct 4 ms 9116 KB Output is correct
3 Correct 4 ms 9044 KB Output is correct
4 Correct 4 ms 9044 KB Output is correct
5 Correct 5 ms 9044 KB Output is correct
6 Correct 4 ms 9044 KB Output is correct
7 Correct 4 ms 9044 KB Output is correct
8 Correct 5 ms 9116 KB Output is correct
9 Correct 4 ms 9044 KB Output is correct
10 Correct 4 ms 9044 KB Output is correct
11 Correct 4 ms 9044 KB Output is correct
12 Correct 4 ms 9044 KB Output is correct
13 Correct 4 ms 9044 KB Output is correct
14 Correct 4 ms 9044 KB Output is correct
15 Correct 5 ms 9044 KB Output is correct
16 Correct 4 ms 9044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 9044 KB Output is correct
2 Correct 4 ms 9116 KB Output is correct
3 Correct 4 ms 9044 KB Output is correct
4 Correct 4 ms 9044 KB Output is correct
5 Correct 5 ms 9044 KB Output is correct
6 Correct 4 ms 9044 KB Output is correct
7 Correct 4 ms 9044 KB Output is correct
8 Correct 5 ms 9116 KB Output is correct
9 Correct 4 ms 9044 KB Output is correct
10 Correct 4 ms 9044 KB Output is correct
11 Correct 4 ms 9044 KB Output is correct
12 Correct 4 ms 9044 KB Output is correct
13 Correct 4 ms 9044 KB Output is correct
14 Correct 4 ms 9044 KB Output is correct
15 Correct 5 ms 9044 KB Output is correct
16 Correct 4 ms 9044 KB Output is correct
17 Correct 5 ms 9132 KB Output is correct
18 Correct 4 ms 9044 KB Output is correct
19 Correct 4 ms 9044 KB Output is correct
20 Correct 4 ms 9172 KB Output is correct
21 Correct 4 ms 9080 KB Output is correct
22 Incorrect 4 ms 9172 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 9044 KB Output is correct
2 Correct 4 ms 9116 KB Output is correct
3 Correct 4 ms 9044 KB Output is correct
4 Correct 4 ms 9044 KB Output is correct
5 Correct 5 ms 9044 KB Output is correct
6 Correct 4 ms 9044 KB Output is correct
7 Correct 4 ms 9044 KB Output is correct
8 Correct 5 ms 9116 KB Output is correct
9 Correct 4 ms 9044 KB Output is correct
10 Correct 4 ms 9044 KB Output is correct
11 Correct 4 ms 9044 KB Output is correct
12 Correct 4 ms 9044 KB Output is correct
13 Correct 4 ms 9044 KB Output is correct
14 Correct 4 ms 9044 KB Output is correct
15 Correct 5 ms 9044 KB Output is correct
16 Correct 4 ms 9044 KB Output is correct
17 Correct 5 ms 9132 KB Output is correct
18 Correct 4 ms 9044 KB Output is correct
19 Correct 4 ms 9044 KB Output is correct
20 Correct 4 ms 9172 KB Output is correct
21 Correct 4 ms 9080 KB Output is correct
22 Incorrect 4 ms 9172 KB Output isn't correct
23 Halted 0 ms 0 KB -