Submission #855447


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,x,n) for (int i = x;i < n;++i)

int x[1001];

int main() {
	int n;
	scanf("%d", &n);
	f(i, 1, n + 1)scanf("%d", x + i);
	int l, q;
	scanf("%d%d", &l, &q);
	while (q--) {
		int a, b;
		scanf("%d%d", &a, &b);
		if (a > b)swap(a, b);
		int an = 1;
		int st = 0;
		while (a < b) {
			st += x[a + 1] - x[a];
			if (st > l)st = x[a + 1] - x[a], ++an;
			++a;
		}
		printf("%d\n", an);
	}
}

Submission Info

Submission Time
Task E - Tak and Hotels
User Motarack
Language C++14 (GCC 5.4.1)
Score 200
Code Size 487 Byte
Status RE
Exec Time 678 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
./Main.cpp:11:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  f(i, 1, n + 1)scanf("%d", x + i);
                                  ^
./Main.cpp:13:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &l, &q);
                       ^
./Main.cpp:16:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &a, &b);
                        ^

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 0 / 500
Status
AC × 1
AC × 14
AC × 14
RE × 13
Set Name Test Cases
Sample example_01.txt
Subtask1 example_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt
All example_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt
Case Name Status Exec Time Memory
example_01.txt AC 4 ms 256 KB
subtask1_01.txt AC 4 ms 256 KB
subtask1_02.txt AC 4 ms 256 KB
subtask1_03.txt AC 5 ms 256 KB
subtask1_04.txt AC 5 ms 256 KB
subtask1_05.txt AC 5 ms 256 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 5 ms 256 KB
subtask1_09.txt AC 5 ms 256 KB
subtask1_10.txt AC 6 ms 256 KB
subtask1_11.txt AC 5 ms 256 KB
subtask1_12.txt AC 6 ms 256 KB
subtask1_13.txt AC 5 ms 256 KB
subtask2_01.txt RE 678 ms 256 KB
subtask2_02.txt RE 190 ms 256 KB
subtask2_03.txt RE 195 ms 256 KB
subtask2_04.txt RE 188 ms 256 KB
subtask2_05.txt RE 187 ms 256 KB
subtask2_06.txt RE 189 ms 256 KB
subtask2_07.txt RE 187 ms 256 KB
subtask2_08.txt RE 187 ms 256 KB
subtask2_09.txt RE 191 ms 256 KB
subtask2_10.txt RE 189 ms 256 KB
subtask2_11.txt RE 188 ms 256 KB
subtask2_12.txt RE 186 ms 256 KB
subtask2_13.txt RE 189 ms 256 KB