답안 #71891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71891 2018-08-25T19:06:02 Z :p(#2229, exqt) 십자가 놓기 (FXCUP3_cross) C++17
0 / 100
3 ms 480 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
const int MOD = 1e9+7;

int main()
{
  int n; cin >> n;
  vector<array<ll, 4>> dp(n+1);

  dp[1] = {1, 0, 0, 0};
  dp[2] = {1, 0, 0, 0};

  for(int i=3; i<=n; i++)
  {
    dp[i][0] = (dp[i-1][0] + dp[i-1][1] + dp[i-1][2] + dp[i-1][3]) % MOD;
    dp[i][1] = (dp[i-1][0] + dp[i-1][3] - 2*dp[i-2][1] + 2*MOD) % MOD;
    dp[i][2] = (dp[i-1][0] - dp[i-2][2] + MOD) % MOD;
    dp[i][3] = (dp[i-1][0] + dp[i-1][1] - 2*dp[i-2][3] + 2*MOD) % MOD;

    // cout << dp[i][0] << ' ' << dp[i][1] << ' ' << dp[i][2] << ' ' << dp[i][3] << ' ' << endl;
  }

  cout << (dp[n][0] + dp[n][1] + dp[n][2] + dp[n][3])%MOD << endl;

  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 480 KB Output is correct
4 Incorrect 2 ms 480 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 480 KB Output is correct
4 Incorrect 2 ms 480 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 480 KB Output is correct
4 Incorrect 2 ms 480 KB Output isn't correct
5 Halted 0 ms 0 KB -