結果
| 問題 |
No.274 The Wall
|
| コンテスト | |
| ユーザー |
@abcde
|
| 提出日時 | 2019-06-29 02:23:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 588 bytes |
| コンパイル時間 | 1,400 ms |
| コンパイル使用メモリ | 160,344 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-17 19:02:41 |
| 合計ジャッジ時間 | 2,431 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d %d", &N, &M);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d %d", &L, &R);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
// 別解の動作確認用.
// ishizu氏.
// https://yukicoder.me/submissions/46140
#include <bits/stdc++.h>
using namespace std;
int cnt[4001];
int main(){
// 1. 入力.
int N, M;
scanf("%d %d", &N, &M);
// 2. 判定.
for(int i = 0; i < N; i++){
int L, R;
scanf("%d %d", &L, &R);
for(int j = L; j < R + 1; j++) cnt[j]++;
for(int j = M - R - 1; j < M - L; j++) cnt[j]++;
}
// 3. 出力.
for(int i = 0; i < M; i++) if(cnt[i] > 2) { printf("%s\n", "NO"); return 0;}
printf("%s\n", "YES");
return 0;
}
@abcde