結果
| 問題 | No.1492 01文字列と転倒 |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-01-19 21:23:45 |
| 言語 | C++17(clang) (clang++ 21.1.8 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 920 bytes |
| 記録 | |
| コンパイル時間 | 3,714 ms |
| コンパイル使用メモリ | 147,196 KB |
| 実行使用メモリ | 19,400 KB |
| 最終ジャッジ日時 | 2026-03-06 17:56:07 |
| 合計ジャッジ時間 | 6,028 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 15 |
コンパイルメッセージ
main.cpp:22:16: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
22 | ll dp[N + 1][N * N + 1];
| ^~~~~~~~~
main.cpp:22:16: note: read of non-const variable 'N' is not allowed in a constant expression
main.cpp:19:7: note: declared here
19 | int N, M;
| ^
main.cpp:22:9: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
22 | ll dp[N + 1][N * N + 1];
| ^~~~~
main.cpp:22:9: note: read of non-const variable 'N' is not allowed in a constant expression
main.cpp:19:7: note: declared here
19 | int N, M;
| ^
main.cpp:27:20: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
27 | ll temp[N + 1][N * N + 1];
| ^~~~~~~~~
main.cpp:27:20: note: read of non-const variable 'N' is not allowed in a constant expression
main.cpp:19:7: note: declared here
19 | int N, M;
| ^
main.cpp:27:13: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
27 | ll temp[N + 1][N * N + 1];
| ^~~~~
main.cpp:27:13: note: read of non-const variable 'N' is not allowed in a constant expression
main.cpp:19:7: note: declared here
19 | int N, M;
| ^
4 warnings generated.
ソースコード
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
int main() {
int N, M;
cin >> N >> M;
ll dp[N + 1][N * N + 1];
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 0; i < 2 * N; ++i) {
ll temp[N + 1][N * N + 1];
memset(temp, 0, sizeof(temp));
for (int zc = 0; zc <= N; ++zc) {
int oc = i - zc;
if (oc > zc) continue;
for (int k = 0; k < N * N; ++k) {
if (oc + 1 <= zc) {
temp[zc][k] += dp[zc][k];
}
if (zc + 1 <= N) {
temp[zc + 1][k + oc] += dp[zc][k];
}
}
}
memcpy(dp, temp, sizeof(temp));
}
for (int k = 0; k <= N * N; ++k) {
cout << dp[N][k] << endl;
}
return 0;
}
siman