# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
894912 | 2023-12-29T08:12:00 Z | LeonaRaging | Flip it and Stick it (CCO23_day2problem1) | C++14 | 2 ms | 976 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb emplace_back #define pf emplace_front #define fi first #define se second #define T pair<int,int> #define all(val) val.begin(), val.end() #define SZ(val) (int)val.size() #define db(val) "[" #val " = " << (val) << "] " const int maxn = 3e5 + 4; const int N = 16; const int mod = 1e9 + 7; const int INF = 1e9; void coding() { if (fopen("inputf.in", "r")) { freopen("inputf.in", "r", stdin); freopen("outputf.out", "w", stdout); freopen("log.out", "w", stderr); } if (fopen(".INP", "r")) { freopen(".INP", "r", stdin); freopen(".OUT", "w", stdout); } } string s, t; namespace sub1 { void Solve() { bool f = 0; for (int i = 0; i < SZ(s); i++) if (s[i] == '0') return cout << -1, void(); cout << 0; } } namespace sub2 { void Solve() { int res = 0; for (int i = 0; i < SZ(s) - 1; i++) if (s[i] == '0' && s[i + 1] == '1') res++; cout << res; } } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); coding(); cin >> s >> t; if (t[0] == '1') { for (int i = 0; i < SZ(t); i++) if (t[i] == '0') t[i] = '1'; else t[i] = '0'; for (int i = 0; i < SZ(s); i++) if (s[i] == '0') s[i] = '1'; else s[i] = '0'; } if (t == "0") sub1::Solve(); if (t == "01") sub2::Solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 736 KB | Output is correct |
4 | Correct | 1 ms | 740 KB | Output is correct |
5 | Correct | 1 ms | 740 KB | Output is correct |
6 | Correct | 1 ms | 740 KB | Output is correct |
7 | Correct | 1 ms | 740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 424 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 860 KB | Output is correct |
7 | Correct | 1 ms | 976 KB | Output is correct |
8 | Correct | 1 ms | 860 KB | Output is correct |
9 | Correct | 2 ms | 856 KB | Output is correct |
10 | Correct | 2 ms | 860 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 424 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 860 KB | Output is correct |
7 | Correct | 1 ms | 976 KB | Output is correct |
8 | Correct | 1 ms | 860 KB | Output is correct |
9 | Correct | 2 ms | 856 KB | Output is correct |
10 | Correct | 2 ms | 860 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Incorrect | 0 ms | 348 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |