# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
793576 | 2023-07-26T04:08:26 Z | 반딧불(#10057) | Flip it and Stick it (CCO23_day2problem1) | C++17 | 4 ms | 1380 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; int arr[200002]; int k; int b[4]; void input(); void solvek1(); void solvek2(); int main(){ input(); if(k==1) solvek1(); if(k==2) solvek2(); } void input(){ string str; cin >> str; n = (int)str.size(); for(int i=1; i<=n; i++) arr[i] = (str[i-1] - '0'); cin >> str; k = (int)str.size(); for(int i=1; i<=k; i++) b[i] = (str[i-1] - '0'); } void solvek1(){ if(count(arr+1, arr+n+1, b[1])) printf("-1"); else printf("0"); exit(0); } void solvek2(){ ll ans = 0; if(b[1] != b[2]){ int l = b[2], r = b[1]; int rCnt = 0; for(int i=1; i<=n; i++){ if(arr[i] == r) rCnt++; else ans += rCnt; } } else{ } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 4 ms | 1380 KB | Output is correct |
4 | Correct | 4 ms | 1300 KB | Output is correct |
5 | Correct | 4 ms | 1380 KB | Output is correct |
6 | Correct | 4 ms | 1380 KB | Output is correct |
7 | Correct | 4 ms | 1252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 1 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 1 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |