結果

問題 No.1673 Lamps on a line
ユーザー たまごん
提出日時 2021-09-10 21:57:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 2,184 ms
コンパイル使用メモリ 171,532 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-11 23:47:58
合計ジャッジ時間 5,881 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

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, ans;
    cin >> n >> q;
    vector<int> a;
    rep(i,q){
        int l, r;
        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