제출 #958652

#제출 시각아이디문제언어결과실행 시간메모리
958652Mher777거래 (IZhO13_trading)C++17
0 / 100
1 ms2392 KiB
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <queue> #include <iomanip> #include <bitset> #include <stack> #include <cassert> #include <iterator> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(), v.end() using namespace std; const int N = 100005; int n, m, a[4][N], dp[N][(1 << 2) + 4], msk[N]; int main() { cin >> n >> m; while (m--) { int y, x; scanf("%d%d", &x, &y); y--; msk[x] |= (1 << y); } dp[0][3] = 1; for (int i = 0; i <= n; i++) { for (int mask = 0; mask < (1 << 2); mask++) { if ((mask & msk[i]) != msk[i]) continue; //cout << "dp[" << i << "][" << mask << "]=" << dp[i][mask] << endl; for (int nxt = 0; nxt < (1 << 2); nxt++) { if ((nxt & msk[i + 1]) != msk[i + 1]) continue; LL x = 1; for (int j = 0; j <= 1; j++) { int bit1 = (bool)(mask & (1 << j)); int bit2 = (bool)(nxt & (1 << j)); if (bit1 == 0 && (bit2 == 0 || ((1 << j) & msk[i + 1]) != 0)) x = 0; } dp[i + 1][nxt] += (x * dp[i][mask]) % mod; dp[i + 1][nxt] %= mod; } } if (msk[i + 1] == 0) { dp[i + 1][3] += dp[i][3]; dp[i + 1][3] %= mod; } } cout << dp[n][3] << endl; return 0; } /* */

컴파일 시 표준 에러 (stderr) 메시지

trading.cpp: In function 'int main()':
trading.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         scanf("%d%d", &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...