Submission #1476122


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define int long long

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, q;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> q;
    rep(i, q) {
        int ans = 0;
        int a, b, s, t;
        cin >> a >> b >> s >> t;
        if (b <= s) cout << (t - s) * 100LL << endl;
        else if (a <= s) {
            if (b <= t) cout << (t - b) * 100LL << endl;
            else cout << 0 << endl;
        }
        else if (s <= a && a <= t) {
            if (b <= t) cout << (t - s - (b - a)) * 100LL << endl;
            else cout << (a - s) * 100LL << endl;
        }
        else cout << (t - s) * 100LL << endl;
    }
}

Submission Info

Submission Time
Task D - 定期券
User roto_37
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1457 Byte
Status AC
Exec Time 188 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 92 ms 640 KB
large_02.txt AC 185 ms 1024 KB
random_01.txt AC 188 ms 896 KB
random_02.txt AC 185 ms 896 KB
random_03.txt AC 186 ms 896 KB
random_04.txt AC 185 ms 896 KB
random_05.txt AC 185 ms 896 KB
random_06.txt AC 185 ms 896 KB
random_07.txt AC 183 ms 896 KB
random_08.txt AC 184 ms 896 KB
random_09.txt AC 183 ms 896 KB
random_10.txt AC 186 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