QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563859 | #8689. Compression | Detach | WA | 1ms | 3756kb | C++17 | 1.5kb | 2024-09-14 16:25:17 | 2024-09-14 16:25:19 |
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;
char c, las = '5';
while((c = getchar()) != EOF) {
if(c == las) continue;
las = c;
s += c;
}
if(s.size() <= 2) {
cout << s << endl;
return;
}
string ans;
ans += s[0];
ans += s[1];
if(s.size() & 1) {
ans += s[0];
}
cout << ans << 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: 1ms
memory: 3676kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
0
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3756kb
input:
111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000...
output:
101
result:
wrong answer 1st lines differ - expected: '10', found: '101'