結果
問題 | No.945 YKC饅頭 |
ユーザー | tarattata1 |
提出日時 | 2019-12-08 00:12:12 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 258 ms / 2,000 ms |
コード長 | 1,370 bytes |
コンパイル時間 | 1,073 ms |
コンパイル使用メモリ | 79,308 KB |
実行使用メモリ | 13,292 KB |
最終ジャッジ日時 | 2024-12-26 18:42:31 |
合計ジャッジ時間 | 9,281 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 74 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’: main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | scanf("%d%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:42:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 42 | scanf("%d%d%s", &l, &r, str); l--; | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <iterator> #include <assert.h> #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; //const long long MOD = 998244353; using namespace std; int main(int argc, char* argv[]) { int n,m; scanf("%d%d", &n, &m); char str[4]={0}; set<int> z; int cnt[3]={0}; int i; for(i=0; i<n; i++) { z.insert(i); } for(i=0; i<m; i++) { int l,r; scanf("%d%d%s", &l, &r, str); l--; auto it0=z.lower_bound(l); auto it1=z.lower_bound(r); int now=2; if(str[0]=='Y') { now=0; } else if(str[0]=='K') { now=1; } vector<int> del; for(; it0!=it1; ++it0) { int tmp=(*it0); cnt[now]++; del.push_back(tmp); } int p; for(p=0; p<(int)del.size(); p++) { z.erase(del[p]); } } for(i=0; i<3; i++) { printf("%d ", cnt[i]); } printf("\n"); return 0; }