結果
問題 |
No.274 The Wall
|
ユーザー |
|
提出日時 | 2016-04-03 00:27:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 954 bytes |
コンパイル時間 | 1,580 ms |
コンパイル使用メモリ | 159,684 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 12:31:24 |
合計ジャッジ時間 | 2,504 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 WA * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, l, r; bool f; string ans = "YES"; cin >> n >> m; vector<int> a(m,0); for(int i = 0; i < n; i++) { cin >> l >> r; f = true; for(int j = l; j <= r; j++) { if(a[j]) { f = false; break; } } if (f) { for(int j = l; j <= r; j++) a[j] = 1; } else { l = m - 1 - l; r = m - 1 - r; f = true; for(int j = r; j <= l; j++) { if(a[j]) { f = false; break; } } if (f) { for(int j = r; j <= l; j++) a[j] = 1; } else { ans = "NO"; break; } } } cout << ans << "\n"; return 0; }