QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116964#6667. Prosjekxtqqwq#0 125ms54800kbC++141.3kb2023-06-30 11:38:032024-05-31 18:36:06

Judging History

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

  • [2024-05-31 18:36:06]
  • 评测
  • 测评结果:0
  • 用时:125ms
  • 内存:54800kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 11:38:03]
  • 提交

answer

#include<bits/stdc++.h>

#define pb push_back
#define fi first
#define se second
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;

template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n;
int a[1000005];
vector<int> b[20][100005];

void solve(){
	n=readint();
	for(int i=1;i<=n;i++) a[i]=readint();
	b[2][0].clear(),b[2][1].clear();
	for(int i=1;i<=n;i++) b[2][a[i]%4].pb(a[i]);
	for(int i=1;i<n;i++){
		if(b[2][0].size()>=2){
			int x=b[2][0].back(); b[2][0].pop_back();
			int y=b[2][0].back(); b[2][0].pop_back();
			printf("%d %d\n",x,y);
			b[2][(x+y)/2%4].pb((x+y)/2);
		}
		else if(b[2][2].size()>=2){
			int x=b[2][2].back(); b[2][2].pop_back();
			int y=b[2][2].back(); b[2][2].pop_back();
			printf("%d %d\n",x,y);
			b[2][(x+y)/2%4].pb((x+y)/2);
		}
		else printf("%d %d\n",b[2][0][0],b[2][0][1]);
	}
}

int main(){
	int T=readint();
	while(T--) solve();
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 51700kb

input:

99
4
739880851158065302 19206582949872932 883064254701115295 222072661880779376
7
148399819461615003 209088712310207988 53191076581680214 445068618251612752 230505279594622109 115754892157516718 804173775829453588
2
77979357045500669 41693388829622019
3
341612949433488278 609808714829036935 19994167...

output:

-843402640 303269156
303269156 -843402640
303269156 -843402640
-704656620 -611339696
2009806324 -611339696
2009806324 -611339696
2009806324 -611339696
2009806324 -611339696
2009806324 -611339696
2009806324 -611339696
-993863688 -611339696
-993863688 -611339696
-192465568 -1096270264
1702461242 20237...

result:

wrong answer Integer -843402640 violates the range [0, 10^18] (test case 1)

Subtask #2:

score: 0
Runtime Error

Test #16:

score: 0
Runtime Error

input:

100
3
3 3 2
3
4 1 1
4
1 3 4 4
6
4 4 2 3 1 2
4
0 2 1 4
3
0 2 0
7
3 3 1 1 3 4 0
2
0 4
4
1 4 2 3
7
4 0 0 3 2 3 4
4
4 2 0 3
7
0 2 2 1 4 2 4
7
3 0 3 1 2 0 3
4
4 3 1 4
6
2 3 0 1 3 4
5
1 4 0 3 4
5
4 2 0 4 2
3
0 1 2
6
4 1 4 2 0 4
7
4 2 4 3 1 3 1
4
1 4 4 0
2
1 1
6
0 3 3 0 0 4
7
4 3 0 3 3 3 4
4
4 1 1 3
6
2 0 ...

output:


result:


Subtask #3:

score: 0
Wrong Answer

Test #34:

score: 0
Wrong Answer
time: 91ms
memory: 52552kb

input:

100000
5
846784256447769304 457696478728961702 128469521648960690 597630796847754190 104256763714529164
5
658897822238868978 472135077337628566 399538027669313322 622703684108675696 425723088635325654
5
917704960887390986 140817562615382054 877934664521057998 782212806618666818 616380973421914538
8
...

output:

1721952140 1995860696
418491342 1784267954
-1046104000 1721952140
-1046104000 1721952140
628971306 231966194
-1818236304 1721952140
-1818236304 1721952140
-1818236304 1721952140
1027888962 113739470
570814216 1721952140
570814216 1721952140
570814216 1721952140
1405542524 1441092800
1313114692 -1800...

result:

wrong answer Integer -1046104000 violates the range [0, 10^18] (test case 1)

Subtask #4:

score: 0
Wrong Answer

Test #46:

score: 0
Wrong Answer
time: 125ms
memory: 54800kb

input:

100
211957
911918942087402387 344230223346742784 16289402153237664 528890583619159010 886281719684850237 865484734102017297 321851390502278959 754268375474197153 237414161302130571 135637002716682378 824412491959977735 162505521049217610 246319278060116103 666703181591704279 650875500699154233 96397...

output:

-1440098232 397428808
-521334712 -952604600
-736969656 -415596544
-576283100 -729306944
139907252 1534639764
837273508 -3273144
404258380 2086713308
-901997804 -1601359100
895805196 -1449715908
-276955356 -1462051372
-869503364 1359238076
244867356 1750011744
1579633624 1925523048
-394905312 -187295...

result:

wrong answer Integer -521334712 violates the range [0, 10^18] (test case 1)