Submission #1159257

#TimeUsernameProblemLanguageResultExecution timeMemory
1159257Der_VlaposMonochrome Points (JOI20_monochrome)C++20
25 / 100
2095 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<int, int> #define f first #define s second #define all(v) v.begin(), v.end() // #define int ll const int mod1 = 1e9 + 7; const int mod2 = 998244353; int dp1[1003][1003]; int dp2[1003][1003]; struct test { void solve() { int n; cin >> n; vector<int> b, w; for (int i = 0; i < 2 * n; ++i) { char x; cin >> x; if (x == 'B') b.pb(i); else w.pb(i); } int res = 0; for (int k = 0; k < n; ++k) { vector<pii> segs; for (int i = 0; i < n; ++i) segs.pb({min(b[i], w[(i + k) % n]), max(b[i], w[(i + k) % n])}); sort(all(segs)); int cnt = 0; for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) { cnt += (segs[j].f < segs[i].s and segs[i].s < segs[j].s); } res = max(res, cnt); } cout << res << "\n"; } }; main() { test t; t.solve(); }

Compilation message (stderr)

monochrome.cpp:57:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   57 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...