QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#431343#8689. CompressionPHarrAC ✓1ms3896kbC++20454b2024-06-05 13:13:362024-06-05 13:13:36

Judging History

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

  • [2024-06-05 13:13:36]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3896kb
  • [2024-06-05 13:13:36]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	string s;cin >> s;
	string a;
	char lst = '#';
	for (auto x : s){
		if (x != lst) {
			a.push_back(x);
			lst = x;
		}
	}

	if (a.size() <= 3){
		cout << a;
	}else{
		int m = a.size();
		if (m & 1) {
			cout << a[0] << a[1] << a[2];
		}else{
			cout << a[0] << a[1];
		}
	}


	return 0;
}

详细

Test #1:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok single line: '0'

Test #2:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok single line: '1'

Test #3:

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

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: 1ms
memory: 3664kb

input:

111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000111110000011111000001111100000...

output:

10

result:

ok single line: '10'

Test #6:

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

input:

010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

010

result:

ok single line: '010'

Test #7:

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

input:

101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...

output:

101

result:

ok single line: '101'

Test #8:

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

input:

00

output:

0

result:

ok single line: '0'

Test #9:

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

input:

11

output:

1

result:

ok single line: '1'

Test #10:

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

input:

010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

01

result:

ok single line: '01'

Test #11:

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

input:

110101111001011001110110001001100100110000101010011101010101100111001111101100110011010110110010010101010011101010101000001011110010100001000101000100011011000001111010110100001111111010010001011000111110110011000111010000001010100001011010110110101010011001011101110110001000000011000011011000110011...

output:

101

result:

ok single line: '101'

Test #12:

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

input:

000010111010011001100100011111101100000011110010111101101000101111011110101100000001010101101111000110100001101001111101100010011100011101000010010000010010011101111011110100111010101000011001010010000011001000100011011011000011100100111011101100110111111101011111100111000010000011101111100110011001...

output:

01

result:

ok single line: '01'

Test #13:

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

input:

001000001111111011111011010110001100101101111110101001000101000001001011100111101100001001011111001001100001011010100001001000111111010101000011111110101100010111110100100011000011000010010101101110011111100001001110000100110000111010110101110100001010111100010111100000100110110100101101001011100010...

output:

01

result:

ok single line: '01'

Test #14:

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

input:

000101111110101001111001111001001010010010111010001000010010101011100110001000100101010001110000111110111101011111000100100110000110000000010100001010011110011000000001000000001000010111111010010101000011101110100101010010000110001110001101001000110001101011001100111101010010111101011011111110100110...

output:

01

result:

ok single line: '01'

Test #15:

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

input:

111100001101110111100000100000100000010001110101001111101001111011101110011000101101101100010011101110100101110011011101011001101011011011101010101011000001001000000011100100001000000011100001110010110101111101000110110100011011011101110111010101110100011111111011011110010001000010111011100111111001...

output:

101

result:

ok single line: '101'

Test #16:

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

input:

111000000000001111001110101010000010110110001011001001100111111011000010100111000000100101010001010111110011111011111101000100101110001001011000111011000101011110000000001100111101111011101011110011001110001100011110110010001111111000011101001100011000101110000110010010000111011101001011110011111001...

output:

10

result:

ok single line: '10'

Test #17:

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

input:

000101001001011101111111111101011010000001100001111111110001010101101000101110011111011110101010111101010000010011110101010000110111000010000100000010111101101000110100000100111010000001011001001000100001011110111011111101110000111101111110100010101001000110111001001110001011000011010000010000100010...

output:

010

result:

ok single line: '010'

Test #18:

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

input:

101010011101000100011111010101100110101101111010101000110100011010100111101101100111001111000110000011000100000100001110110110010100111110010001100111010010000110000000111111100101001000001001011101111101011111111111001010101111110110000010011001111110001110001101010100011110111100011001111001000001...

output:

101

result:

ok single line: '101'

Test #19:

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

input:

001101001011011011011100101101000000100101001001101010000010111000000010101010100111111111101111110111010001110001101010101011100010111100001001010111000010111100110100010100001001010000011111100100011001111110110110111011010011111110011000110101111110000100100110001100100100000001101000100000100110...

output:

010

result:

ok single line: '010'

Test #20:

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

input:

01101010111111011101010001011101010000110011110001010100010110110111011001100000110010000001001100010000111001001000101

output:

01

result:

ok single line: '01'

Test #21:

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

input:

1011101100100001001001001110110110101101001000110001111

output:

101

result:

ok single line: '101'

Test #22:

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

input:

011110101011011011101101111001111111110000100001111111010110010101100100011011110011011101101100101010000000101101010001100110101100001000000101000000101001101011100010011101100010101101100100010111010111010110011111001001010010100011101101101000001111111010010010010000001101000111011011010000100110...

output:

01

result:

ok single line: '01'

Test #23:

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

input:

001110110000110011101010010001111001100011001001010000101110111110001101101101100001100100111010110111001110000110011010010000010111111000110111100010101111111010100001100011001011010000111100101100110101100001100010101001001101101110011001110000001100111110000111010111101010101111100010001000010111...

output:

01

result:

ok single line: '01'

Test #24:

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

input:

010001000010001111010111100101010101111111001010110010001001110110101101000111101110010111011011000001100100001001010001100101110000001101110001111000100011000110001000000000110110001111011010000000011111101000100110100100010101101000000111100000111001000011111111001110100101111110100001101010001001...

output:

010

result:

ok single line: '010'

Test #25:

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

input:

111110010010111010110100000100011010100000001010000010011111111101110010110101100101010000001000010111001011010100001000010000001101110111101100111001111000001011011000011010111100001011110001011010000100110110111000000010000101000110011100000010000011011101110010111101100011011011101110010000101010...

output:

101

result:

ok single line: '101'

Test #26:

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

input:

111010001

output:

101

result:

ok single line: '101'

Test #27:

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

input:

011101101

output:

01

result:

ok single line: '01'

Test #28:

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

input:

010

output:

010

result:

ok single line: '010'

Test #29:

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

input:

0111010

output:

010

result:

ok single line: '010'

Test #30:

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

input:

1001110100

output:

10

result:

ok single line: '10'

Extra Test:

score: 0
Extra Test Passed