답안 #1050067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050067 2024-08-09T07:10:29 Z vjudge1 Dango Maker (JOI18_dango_maker) C++17
13 / 100
2000 ms 4444 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
int n, m;
vector<pair<int ,int>> v;int mx=0;
void b(string * s, int mas[][3000], int sh, int p){
    if(p==v.size()){
        mx=max(mx, sh);
        return;
    }
    int x=v[p].f, y=v[p].s;
    int a[n][3000];string sm[n];
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            a[i][j]=mas[i][j];
        }
        sm[i]=s[i];
    }
    if(x<n-2){
        if(a[x+1][y]==0&&s[x+1][y]=='G'&&s[x+2][y]=='W'&&a[x+2][y]==0){
            a[x+1][y]=1;a[x+2][y]=1;
            b(s, a, sh+1, p+1);
            a[x+1][y]=0;a[x+2][y]=0;
        }
    }
    if(y<m-2){
        if(a[x][y+1]==0&&s[x][y+1]=='G'&&s[x][y+2]=='W'&&a[x][y+2]==0){
            a[x][y+1]=1;a[x][y+2]=1;
            b(s, a, sh+1, p+1);
            a[x][y+1]=0;a[x][y+2]=0;
        }
    }
    b(s, a, sh, p+1);
}
int main() {
    cin >> n >> m;
    string s[n];
    int mas[n][3000];
    for(int i=0; i<n; i++){
        cin >> s[i];
        for(int j=0; j<m; j++){
            if(s[i][j]=='R'){
                v.push_back({i, j});
            }
            mas[i][j]=0;
        }
    }
    b(s, mas, 0, 0);
    cout << mx;
    return 0;
}

Compilation message

dango_maker.cpp: In function 'void b(std::string*, int (*)[3000], int, int)':
dango_maker.cpp:8:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     if(p==v.size()){
      |        ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 860 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 860 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 1116 KB Output is correct
18 Correct 0 ms 1116 KB Output is correct
19 Correct 7 ms 2160 KB Output is correct
20 Correct 175 ms 3676 KB Output is correct
21 Correct 134 ms 4444 KB Output is correct
22 Correct 928 ms 3928 KB Output is correct
23 Correct 2 ms 4440 KB Output is correct
24 Correct 2 ms 4440 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Execution timed out 2100 ms 4444 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 860 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 1116 KB Output is correct
18 Correct 0 ms 1116 KB Output is correct
19 Correct 7 ms 2160 KB Output is correct
20 Correct 175 ms 3676 KB Output is correct
21 Correct 134 ms 4444 KB Output is correct
22 Correct 928 ms 3928 KB Output is correct
23 Correct 2 ms 4440 KB Output is correct
24 Correct 2 ms 4440 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Execution timed out 2100 ms 4444 KB Time limit exceeded
28 Halted 0 ms 0 KB -