QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#106181#6394. Turn on the LightSylvia#WA 3ms3360kbC++11243b2023-05-16 20:06:032023-05-16 20:06:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-16 20:06:04]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3360kb
  • [2023-05-16 20:06:03]
  • 提交

answer

#include<iostream>

using namespace std;

int n;
int x;

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cout << "? " << i << endl;
		cout.flush();
		cin >> x;
		if(x != i) {
			cout << "! " << i;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3240kb

input:

3
1
2
2

output:

? 1
? 2
? 3
! 3

result:

ok Correct position at 3

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3360kb

input:

10
1
2
3
4
5
6
7
8
8

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
! 9? 10

result:

wrong answer format  Expected integer, but "9?" found