結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-10 21:21:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 204 ms / 2,000 ms |
| コード長 | 235 bytes |
| コンパイル時間 | 620 ms |
| コンパイル使用メモリ | 63,232 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 22:11:33 |
| 合計ジャッジ時間 | 2,590 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int N,Q;
int A[5<<17];
main()
{
cin>>N>>Q;
int cnt=0;
for(;Q--;)
{
int l,r;cin>>l>>r;
for(int i=l;i<=r;i++)
{
if(A[i])cnt--,A[i]=0;
else cnt++,A[i]=1;
}
cout<<cnt<<"\n";
}
}