QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#65023#4592. Theramorezzxzzx123#AC ✓15ms3584kbC++414b2022-11-26 15:54:402022-11-26 15:54:42

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-26 15:54:42]
  • 评测
  • 测评结果:AC
  • 用时:15ms
  • 内存:3584kb
  • [2022-11-26 15:54:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int sum[2][2];
int main(){
	int t;
	cin>>t;
	while(t--){
		memset(sum,0,sizeof sum);
		string s;
		cin>>s;
		string a;
		a=s;		
		for(int i=0;s[i];i++){
			a[i]='0';
			sum[(s[i]-'0')][i&1]++;
		}
		for(int i=a.size()-1;i>=0;i--){
			if(sum[1][i&1]){
				a[i]='1';
				sum[1][i&1]--;
			}
		}
		cout<<a<<endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10
101001
01101100000000101010
11100100010110110011101010011111111010110100011100000001101011111001101000001010101001101101010011100101001000001011111011010001111110100101100010111110011000000101110110110001010100110001000110001101110011001101101101011000011010011010101111010010111010001001010111111...

output:

001011
00000000001010101111
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 10 lines