Submission #293886

#TimeUsernameProblemLanguageResultExecution timeMemory
293886BTheroMonochrome Points (JOI20_monochrome)C++17
35 / 100
1099 ms512 KiB
// chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; const int MAXN = 300 + 5; const int INF = (int)1e9; char s[2 * MAXN]; int n, ans; void solve() { scanf("%d", &n); scanf("%s", s); for (int i = 0; i < 2 * n; ++i) { vector<char> vec; for (int j = 0; j < n; ++j) { vec.pb(s[j]); } int cur = 0; for (int j = n; j < 2 * n; ++j) { auto it = find(all(vec), ('B' ^ 'W' ^ s[j])); cur += (vec.end() - it - 1); vec.erase(it); } ans = max(ans, cur); rotate(s, s + 1, s + 2 * n); } printf("%d\n", ans); } int main() { int tt = 1; while (tt--) { solve(); } return 0; }

Compilation message (stderr)

monochrome.cpp: In function 'void solve()':
monochrome.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
monochrome.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   25 |   scanf("%s", s);
      |   ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...