QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#448158#8689. Compressionjames1BadCreeper#WA 1ms3820kbC++17551b2024-06-19 12:53:212024-06-19 12:53:22

Judging History

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

  • [2024-06-19 12:53:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3820kb
  • [2024-06-19 12:53:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5; 

int n, m; 
char a[N], b[N]; 

int main(void) {
    cin >> a + 1; n = strlen(a + 1); 
    for (int i = 1; i <= n; ++i)
        if (m && b[m] == a[i]) continue; 
        else b[++m] = a[i]; 
    vector<int> del(m + 5); 
    for (int i = 3; i <= m; ++i)
        if (i + 1 <= m && b[i] == b[i - 2] && b[i + 1] == b[i - 1])
            del[i] = del[i + 1] = 1; 
    for (int i = 1; i <= m; ++i)
        if (!del[i]) cout << b[i]; 
    cout << "\n"; 
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3648kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok single line: '0'

Test #2:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok single line: '1'

Test #3:

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

input:

0

output:

0

result:

ok single line: '0'

Test #4:

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

input:

1

output:

1

result:

ok single line: '1'

Test #5:

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

input:

111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000...

output:

10

result:

ok single line: '10'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3820kb

input:

010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

01

result:

wrong answer 1st lines differ - expected: '010', found: '01'