QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563869 | #8689. Compression | Detach | AC ✓ | 1ms | 4160kb | C++17 | 1.5kb | 2024-09-14 16:32:35 | 2024-09-14 16:32:36 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include <algorithm>
// #include <queue>
// #include <map>
// #include <iostream>
// #include <string>
// #include <set>
#define endl '\n'
// #define int long long
using namespace std;
using namespace __gnu_pbds;
using LL = long long;
using PII = pair<int, int>;
using i128 = __int128_t;
using ULL = unsigned long long;
using Tree = tree<PII, null_type, less<PII>, rb_tree_tag, tree_order_statistics_node_update>;
constexpr int INF = 0x3f3f3f3f, MOD = 1e9 + 7, N = 1e6 + 5, M = 1e6 + 5;
constexpr LL LINF = 0x3f3f3f3f3f3f3f3f;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve()
{
string s;
cin >> s;
int n = s.size();
vector<int> a;
for(int i = 0; i < n; i ++) {
if(!a.empty() and a.back() == s[i] - '0') continue;
a.push_back(s[i] - '0');
}
if(a.size() < 2) {
cout << a[0] << endl;
} else if(a.size() % 2 == 0) {
cout << a[0] << a[1] << endl;
} else {
cout << a[0] << a[1] << a.back() << endl;
}
}
signed main()
{
// (.*) "$1"
// freopen("park.in", "r", stdin);
// freopen("park.out", "w", stdout);
// cout << fixed << setprecision(2);
// srand(NULL);
ios::sync_with_stdio(false), cin.tie(nullptr);
int T = 1;
// cin >> T;
while(T -- )
solve();
// fclose(stdin);
// fclose(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4008kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
0
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000...
output:
10
result:
ok single line: '10'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
010
result:
ok single line: '010'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...
output:
101
result:
ok single line: '101'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
00
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
11
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
01
result:
ok single line: '01'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
110101111001011001110110001001100100110000101010011101010101100111001111101100110011010110110010010101010011101010101000001011110010100001000101000100011011000001111010110100001111111010010001011000111110110011000111010000001010100001011010110110101010011001011101110110001000000011000011011000110011...
output:
101
result:
ok single line: '101'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
000010111010011001100100011111101100000011110010111101101000101111011110101100000001010101101111000110100001101001111101100010011100011101000010010000010010011101111011110100111010101000011001010010000011001000100011011011000011100100111011101100110111111101011111100111000010000011101111100110011001...
output:
01
result:
ok single line: '01'
Test #13:
score: 0
Accepted
time: 1ms
memory: 4064kb
input:
001000001111111011111011010110001100101101111110101001000101000001001011100111101100001001011111001001100001011010100001001000111111010101000011111110101100010111110100100011000011000010010101101110011111100001001110000100110000111010110101110100001010111100010111100000100110110100101101001011100010...
output:
01
result:
ok single line: '01'
Test #14:
score: 0
Accepted
time: 1ms
memory: 4160kb
input:
000101111110101001111001111001001010010010111010001000010010101011100110001000100101010001110000111110111101011111000100100110000110000000010100001010011110011000000001000000001000010111111010010101000011101110100101010010000110001110001101001000110001101011001100111101010010111101011011111110100110...
output:
01
result:
ok single line: '01'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3996kb
input:
111100001101110111100000100000100000010001110101001111101001111011101110011000101101101100010011101110100101110011011101011001101011011011101010101011000001001000000011100100001000000011100001110010110101111101000110110100011011011101110111010101110100011111111011011110010001000010111011100111111001...
output:
101
result:
ok single line: '101'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
111000000000001111001110101010000010110110001011001001100111111011000010100111000000100101010001010111110011111011111101000100101110001001011000111011000101011110000000001100111101111011101011110011001110001100011110110010001111111000011101001100011000101110000110010010000111011101001011110011111001...
output:
10
result:
ok single line: '10'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
000101001001011101111111111101011010000001100001111111110001010101101000101110011111011110101010111101010000010011110101010000110111000010000100000010111101101000110100000100111010000001011001001000100001011110111011111101110000111101111110100010101001000110111001001110001011000011010000010000100010...
output:
010
result:
ok single line: '010'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
101010011101000100011111010101100110101101111010101000110100011010100111101101100111001111000110000011000100000100001110110110010100111110010001100111010010000110000000111111100101001000001001011101111101011111111111001010101111110110000010011001111110001110001101010100011110111100011001111001000001...
output:
101
result:
ok single line: '101'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
001101001011011011011100101101000000100101001001101010000010111000000010101010100111111111101111110111010001110001101010101011100010111100001001010111000010111100110100010100001001010000011111100100011001111110110110111011010011111110011000110101111110000100100110001100100100000001101000100000100110...
output:
010
result:
ok single line: '010'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
01101010111111011101010001011101010000110011110001010100010110110111011001100000110010000001001100010000111001001000101
output:
01
result:
ok single line: '01'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
1011101100100001001001001110110110101101001000110001111
output:
101
result:
ok single line: '101'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
011110101011011011101101111001111111110000100001111111010110010101100100011011110011011101101100101010000000101101010001100110101100001000000101000000101001101011100010011101100010101101100100010111010111010110011111001001010010100011101101101000001111111010010010010000001101000111011011010000100110...
output:
01
result:
ok single line: '01'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
001110110000110011101010010001111001100011001001010000101110111110001101101101100001100100111010110111001110000110011010010000010111111000110111100010101111111010100001100011001011010000111100101100110101100001100010101001001101101110011001110000001100111110000111010111101010101111100010001000010111...
output:
01
result:
ok single line: '01'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
010001000010001111010111100101010101111111001010110010001001110110101101000111101110010111011011000001100100001001010001100101110000001101110001111000100011000110001000000000110110001111011010000000011111101000100110100100010101101000000111100000111001000011111111001110100101111110100001101010001001...
output:
010
result:
ok single line: '010'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
111110010010111010110100000100011010100000001010000010011111111101110010110101100101010000001000010111001011010100001000010000001101110111101100111001111000001011011000011010111100001011110001011010000100110110111000000010000101000110011100000010000011011101110010111101100011011011101110010000101010...
output:
101
result:
ok single line: '101'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
111010001
output:
101
result:
ok single line: '101'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
011101101
output:
01
result:
ok single line: '01'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
010
output:
010
result:
ok single line: '010'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
0111010
output:
010
result:
ok single line: '010'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
1001110100
output:
10
result:
ok single line: '10'
Extra Test:
score: 0
Extra Test Passed