結果

問題 No.1673 Lamps on a line
ユーザー たまごんたまごん
提出日時 2021-09-10 21:58:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 512 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 169,208 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-09-02 17:25:04
合計ジャッジ時間 5,369 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const long long INF = 1LL << 60;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> a;
    rep(i,q){
        int l, r, ans = 0;
        cin >>  l >> r;
        a.push_back(l);
        a.push_back(r+1);
        sort(all(a));
        for(int j = 0; j < 2*(i+1); j += 2) ans += a[j+1]-a[j];
        cout << ans << endl;
    }
}
0