Submission #20164261


Source Code Expand

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}
int main(){
    int T;
    cin >> T;
    vll ans(T);
    REP(i,T){
        int L,R;
        cin >> L >> R;
        ll cnt = 0;
        if(R-L>=L){
            ll i = R-2*L+1;
            cnt = i*(i+1)/2;
        }
        ans[i] = cnt;
    }
    for(auto a:ans)cout << a << endl;
}

Submission Info

Submission Time
Task A - B = C
User kiuyuki
Language C++ (GCC 9.2.1)
Score 300
Code Size 951 Byte
Status AC
Exec Time 52 ms
Memory 3592 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 11
Set Name Test Cases
Sample sample.txt
All 00maxA.txt, 00maxB.txt, prefix.txt, random.txt, random_2.txt, random_3.txt, random_4.txt, sample.txt, small.txt, small_2.txt, suffix.txt
Case Name Status Exec Time Memory
00maxA.txt AC 52 ms 3492 KiB
00maxB.txt AC 48 ms 3592 KiB
prefix.txt AC 45 ms 3412 KiB
random.txt AC 50 ms 3408 KiB
random_2.txt AC 48 ms 3592 KiB
random_3.txt AC 49 ms 3592 KiB
random_4.txt AC 47 ms 3552 KiB
sample.txt AC 4 ms 3588 KiB
small.txt AC 47 ms 3492 KiB
small_2.txt AC 2 ms 3592 KiB
suffix.txt AC 50 ms 3592 KiB