Submission #570626

# Submission time Handle Problem Language Result Execution time Memory
570626 2022-05-30T19:00:05 Z Hanksburger Dango Maker (JOI18_dango_maker) C++17
100 / 100
312 ms 35908 KB
#include <bits/stdc++.h>
using namespace std;
bool b[3005][3005], c[3005][3005];
char a[3005][3005];
vector<int> v, w;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, ans=0;
    cin >> n >> m;
    for (int i=0; i<n; i++)
        for (int j=0; j<m; j++)
            cin >> a[i][j];
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<m; j++)
        {
            if (a[i][j]=='R' && a[i+1][j]=='G' && a[i+2][j]=='W')
                b[i][j]=1;
            if (a[i][j]=='R' && a[i][j+1]=='G' && a[i][j+2]=='W')
                c[i][j]=1;
        }
    }
    for (int i=0; i<=n+m-2; i++)
    {
        for (int j=max(0, i-m+1); j<=min(n-1, i); j++)
        {
            if (b[j][i-j])
                v.push_back(j*2+5);
            if (c[j][i-j])
                v.push_back(j*2);
        }
        for (int j=0; j<v.size(); j++)
        {
            auto itr=upper_bound(w.begin(), w.end(), v[j]);
            if (itr==w.end())
                w.push_back(v[j]);
            else
                *itr=v[j];
        }
        ans+=w.size();
        v.clear();
        w.clear();
    }
    cout << ans;
    return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:35:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int j=0; j<v.size(); j++)
      |                       ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 0 ms 328 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 224 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 0 ms 328 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 224 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 328 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 328 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 324 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 1 ms 340 KB Output is correct
52 Correct 1 ms 340 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 0 ms 328 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 224 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 328 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 328 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 324 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 1 ms 340 KB Output is correct
52 Correct 1 ms 340 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 7 ms 9556 KB Output is correct
56 Correct 1 ms 340 KB Output is correct
57 Correct 9 ms 14420 KB Output is correct
58 Correct 37 ms 10004 KB Output is correct
59 Correct 310 ms 35612 KB Output is correct
60 Correct 269 ms 35488 KB Output is correct
61 Correct 292 ms 35508 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 252 ms 35216 KB Output is correct
64 Correct 300 ms 35592 KB Output is correct
65 Correct 268 ms 35908 KB Output is correct
66 Correct 312 ms 35648 KB Output is correct
67 Correct 224 ms 25088 KB Output is correct
68 Correct 246 ms 24908 KB Output is correct
69 Correct 232 ms 31424 KB Output is correct
70 Correct 25 ms 10104 KB Output is correct
71 Correct 26 ms 10064 KB Output is correct
72 Correct 29 ms 10040 KB Output is correct
73 Correct 28 ms 10052 KB Output is correct
74 Correct 31 ms 10136 KB Output is correct
75 Correct 33 ms 10088 KB Output is correct
76 Correct 26 ms 10088 KB Output is correct
77 Correct 26 ms 10068 KB Output is correct
78 Correct 27 ms 10104 KB Output is correct
79 Correct 27 ms 10060 KB Output is correct
80 Correct 27 ms 10060 KB Output is correct
81 Correct 26 ms 10136 KB Output is correct
82 Correct 28 ms 10132 KB Output is correct
83 Correct 34 ms 10056 KB Output is correct
84 Correct 29 ms 10056 KB Output is correct
85 Correct 29 ms 10068 KB Output is correct
86 Correct 27 ms 10060 KB Output is correct
87 Correct 26 ms 10100 KB Output is correct
88 Correct 30 ms 10064 KB Output is correct
89 Correct 26 ms 10092 KB Output is correct
90 Correct 37 ms 10140 KB Output is correct