Submission #570626

#TimeUsernameProblemLanguageResultExecution timeMemory
570626HanksburgerDango Maker (JOI18_dango_maker)C++17
100 / 100
312 ms35908 KiB
#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)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...