結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
たまごん
|
| 提出日時 | 2021-09-10 21:43:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 510 bytes |
| コンパイル時間 | 2,032 ms |
| コンパイル使用メモリ | 168,944 KB |
| 実行使用メモリ | 14,016 KB |
| 最終ジャッジ日時 | 2024-06-11 23:08:58 |
| 合計ジャッジ時間 | 6,247 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 5 TLE * 1 -- * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:15: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
20 | b += x;
| ~~^~~~
main.cpp:18:13: note: 'b' was declared here
18 | int b;
| ^
ソースコード
#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 = 0;
cin >> n >> q;
vector<int> a(n+1);
rep(i,q){
int l, r;
cin >> l >> r;
a[l-1]++;
a[r]++;
int b;
for(int x : a){
b += x;
if(b%2==1) ans++;
}
cout << ans << endl;
}
}
たまごん