結果
問題 | No.769 UNOシミュレータ |
ユーザー | toku |
提出日時 | 2019-01-31 23:35:50 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 3,014 bytes |
コンパイル時間 | 1,485 ms |
コンパイル使用メモリ | 161,276 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 09:07:57 |
合計ジャッジ時間 | 3,266 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 5 ms
5,248 KB |
testcase_10 | AC | 5 ms
5,248 KB |
testcase_11 | AC | 5 ms
5,248 KB |
testcase_12 | AC | 29 ms
5,248 KB |
testcase_13 | AC | 29 ms
5,248 KB |
testcase_14 | AC | 29 ms
5,248 KB |
testcase_15 | AC | 57 ms
5,248 KB |
testcase_16 | AC | 57 ms
5,248 KB |
testcase_17 | AC | 56 ms
5,248 KB |
testcase_18 | AC | 85 ms
5,248 KB |
testcase_19 | AC | 85 ms
5,248 KB |
testcase_20 | AC | 84 ms
5,248 KB |
testcase_21 | AC | 84 ms
5,248 KB |
testcase_22 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i,n) for(int i=0; i<int(n); i++) #define FOR(i,m,n) for(int i=int(m); i<int(n); i++) #define ALL(obj) (obj).begin(),(obj).end() #define VI vector<int> #define VLL vector<long long> #define VVI vector<vector<int>> #define VVLL vector<vector<long long>> #define VC vector<char> #define VS vector<string> #define VVC vector<vector<char>> #define fore(i,a) for(auto &i:a) typedef pair <int, int> P; template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 2147483647; const ll INFL = 9223372036854775807; const ll mod = 1000000007; int main() { int n, m; cin >> n >> m; int dt = 0, df = 0; bool b = true; VI v(n, 0); int tmp = 0; REP(i, m) { string s; cin >> s; if (s == "number") { if (dt + df == 0) { v[tmp]++; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } else { v[tmp] -= dt + df; dt = 0; df = 0; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; v[tmp]++; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } } else if (s == "drawtwo") { if (dt) { dt += 2; v[tmp]++; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } else if (df) { v[tmp] -= df; df = 0; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; v[tmp]++; dt = 2; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } else { v[tmp]++; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; dt = 2; } } else if (s == "drawfour") { if (df) { df += 4; v[tmp]++; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } else if (dt) { v[tmp] -= dt; dt = 0; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; v[tmp]++; df = 4; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } else { v[tmp]++; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; df = 4; } } else if (s == "skip") { if (dt + df == 0) { v[tmp]++; if (b)tmp = (tmp + 2) % n; else tmp = (tmp - 2 + n) % n; } else { v[tmp] -= dt + df; dt = 0; df = 0; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; v[tmp]++; if (b)tmp = (tmp + 2) % n; else tmp = (tmp - 2 + n) % n; } } else { if (dt + df == 0) { v[tmp]++; if (b)b = false; else b = true; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } else { v[tmp] -= dt + df; dt = 0; df = 0; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; v[tmp]++; if (b)b = false; else b = true; if (b)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; } } } if (b == false)tmp = (tmp + 1) % n; else tmp = (tmp - 1 + n) % n; cout << tmp + 1 << ' ' << v[tmp] << endl; }