結果
| 問題 | No.1557 Binary Variable |
| コンテスト | |
| ユーザー |
mamimume____mo
|
| 提出日時 | 2021-07-26 12:53:35 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 896 bytes |
| 記録 | |
| コンパイル時間 | 1,962 ms |
| コンパイル使用メモリ | 193,080 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-03 07:00:30 |
| 合計ジャッジ時間 | 11,777 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll INFL = 2e18;
template <class T>bool chmin(T &a, T b){ if (a > b) { a = b; return true;} else return false;}
template <class T>bool chmax(T &a, T b){ if (a < b) { a = b; return true;} else return false;}
int main() {
int N,M;
cin >> N >> M;
vector<pair<int,int>> LR;
for (int i = 0;i < M;i++) {
int L,R;
cin >> L >> R;
LR.push_back({L,R});
}
sort(LR.begin(), LR.end());
int cnt = 0;
for (int i = 0;i < M;i++) {
int l,r;
tie(l, r) = LR[i];
int j = i;
while (true) {
int L,R;
tie(L,R) = LR[j];
if (max(l, L) <= min(r, R)) {
j++;
}
else break;
}
cnt++;
i = j - 1;
}
cout << N - cnt << endl;
}
mamimume____mo