Submission #1925757


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

int main(void) {
	vector<bool> sieve(100001, true);
	sieve[0] = false;
	sieve[1] = false;
	for(int i = 2; i < 50000; ++i) {
		for(int j = 2; i * j < 100001; ++j) {
			sieve[i * j] = false;
		}
	}
	int Q;
	cin >> Q;
	for(int i = 0; i < Q; ++i) {
		int l, r;
		cin >> l >> r;
		int s = 0;
		for(int x = l; x <= r; ++x) {
			if(sieve[x] && sieve[(x + 1) / 2]) {
				++s;
			}
		}
		cout << s << '\n';
	}
	return 0;
}

Submission Info

Submission Time
Task D - 2017-like Number
User waidotto
Language C++14 (GCC 5.4.1)
Score 0
Code Size 492 Byte
Status TLE
Exec Time 2103 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 3
TLE × 7
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt TLE 2103 ms 384 KB
02.txt TLE 2103 ms 384 KB
03.txt TLE 2103 ms 384 KB
04.txt TLE 2103 ms 384 KB
05.txt TLE 2103 ms 256 KB
06.txt TLE 2103 ms 256 KB
07.txt TLE 2103 ms 384 KB
sample_01.txt AC 2 ms 256 KB
sample_02.txt AC 2 ms 256 KB
sample_03.txt AC 2 ms 256 KB