Submission #1110153

# Submission time Handle Problem Language Result Execution time Memory
1110153 2024-11-08T21:09:05 Z Marco_Escandon Dango Maker (JOI18_dango_maker) C++11
13 / 100
1 ms 508 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define x first
#define y second
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>> cad(n,vector<ll>(m,0));
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            char car;
            cin>>car;
            if(car=='R') cad[i][j]=1;
            else if(car=='G') cad[i][j]=2;
            else cad[i][j]=3;
        }
    }
    ll cont=0;
    for(int z=0; z<n; z++)
    {
        map<ll,ll> dp[2];
        ll a=z,b=0;
        ll i=0;
        while(a>=0&&b<m)
        {
            dp[0][i]=max(dp[1][i-3],dp[0][i-1]);
            dp[1][i]=max(dp[0][i-3],dp[1][i-1]);
            if(a>=2)dp[0][i]+=((cad[a][b]==3)&(cad[a-1][b]==2)&(cad[a-2][b]==1));
            if(b>=2)dp[1][i]+=((cad[a][b]==3)&(cad[a][b-1]==2)&(cad[a][b-2]==1));
            a--;
            b++;
            i++;
        }
        cont+=max(dp[0][i-1],dp[1][i-1]);
    }
    for(int z=1; z<m; z++)
    {
        map<ll,ll> dp[2];
        ll a=n-1,b=z;
        ll i=0;
        while(a>=0&&b<m)
        {
            dp[0][i]=max(dp[1][i-3],dp[0][i-1]);
            dp[1][i]=max(dp[0][i-3],dp[1][i-1]);
            if(a>=2)dp[0][i]+=((cad[a][b]==3)&(cad[a-1][b]==2)&(cad[a-2][b]==1));
            if(b>=2)dp[1][i]+=((cad[a][b]==3)&(cad[a][b-1]==2)&(cad[a][b-2]==1));
            a--;
            b++;
            i++;
        }
        cont+=max(dp[0][i-1],dp[1][i-1]);
    }
    cout<<cont;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Incorrect 1 ms 336 KB Output isn't correct
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Incorrect 1 ms 336 KB Output isn't correct
23 Halted 0 ms 0 KB -