Submission #709188

#TimeUsernameProblemLanguageResultExecution timeMemory
709188vjudge1Homework (CEOI22_homework)C++17
13 / 100
24 ms8680 KiB
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") #include<bits/stdc++.h> using namespace std; #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define sz(a) (int)a.size() #define pf push_front #define pb push_back #define vt vector #define s second #define f first #define nl '\n' using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); vt<pii> rid = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; vt<pii> dir = {{-1, -1}, {-1, 1}, {1, -1}, {1, 1}}; const int N = 5e5, mod = 1e9 + 7; const ll inf = 1e18; double eps = 1e-15; bool flg = 0; string s; int f(int tp, int l, int r) { if (r < l) return 0; if (s[l + 1] != (tp ? 'a' : 'i')) return 1; if (s[l + 4] == '?' && s[l + 6] == '?') return 2; if (s[l + 4] == '?') return f(tp, l + 6, r - 1) + 1; else return f(tp, l + 4, r - 3) + 1; } void slv() { cin >> s; if (sz(s) == 1) { cout << 1; return; } int n = 0; for (char c: s) if (c == '?') n++; if (s[4] == s[6] && s[4] == '?') { cout << 1; return; } int cnt; if (s[4] == '?') cnt = f((s[1] == 'a'), 6, sz(s) - 2); else cnt = f((s[1] == 'a'), 4, sz(s) - 4); cout << n - cnt; } main() { //freopen("shops.in", "r", stdin); //freopen("shops.out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); int tp = 1; if (flg) cin >> tp; while (tp--) { slv(); } }

Compilation message (stderr)

Main.cpp:64:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   64 | 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...
#Verdict Execution timeMemoryGrader output
Fetching results...