QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#563850#8689. CompressionDetachWA 1ms3876kbC++171.5kb2024-09-14 16:21:012024-09-14 16:21:02

Judging History

你现在查看的是最新测评结果

  • [2024-09-14 16:21:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3876kb
  • [2024-09-14 16:21:01]
  • 提交

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 = '2';
    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 += (1 - s[0] + '0') + '0';

    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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0


result:

ok single line: '0'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1


result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

0

output:

0


result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

1

output:

1


result:

ok single line: '1'

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 3692kb

input:

111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000...

output:

101

result:

wrong answer 1st lines differ - expected: '10', found: '101'