Submission #1573931


Source Code Expand

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, L, R, H, W;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);


	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> H >> W >> L >> R;
		if (W <= L || H >= R) {
			cout << (R - L) * 100 << endl;
		}
		else if (H > L&&W < R) {
			cout << (R - L - W + H) * 100 << endl;
		}
		else if (H <= L&&W >= R) {
			cout << "0\n";
		}
		else if (H <= L&&W >= L) {
			cout << (R - W) * 100 << endl;
		}
		else if (L <= H&&R >= H) {
			cout << (H - L) * 100 << endl;
		}
		
		
	}
	return 0;
}

Submission Info

Submission Time
Task D - 定期券
User olphe
Language C++14 (GCC 5.4.1)
Score 100
Code Size 930 Byte
Status AC
Exec Time 182 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 16
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All large_01.txt, large_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt, small_01.txt, small_02.txt
Case Name Status Exec Time Memory
large_01.txt AC 95 ms 640 KB
large_02.txt AC 182 ms 1024 KB
random_01.txt AC 164 ms 896 KB
random_02.txt AC 163 ms 896 KB
random_03.txt AC 161 ms 896 KB
random_04.txt AC 163 ms 896 KB
random_05.txt AC 164 ms 896 KB
random_06.txt AC 164 ms 896 KB
random_07.txt AC 163 ms 896 KB
random_08.txt AC 163 ms 896 KB
random_09.txt AC 166 ms 896 KB
random_10.txt AC 163 ms 896 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
small_01.txt AC 1 ms 256 KB
small_02.txt AC 1 ms 256 KB