# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
570626 | Hanksburger | Dango Maker (JOI18_dango_maker) | C++17 | 312 ms | 35908 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |