Submission #1132175
Source Code Expand
#include<bits/stdc++.h> #define P pair<int,int> using namespace std; int main() { int a; cin >> a; if (a <= 8) { int S = 0; int b[8]; for (int c = 0; c < a; c++)cin >> b[c]; int c[8];//ゴールする順番 for (int i = 0; i < a; i++)c[i] = i; bool aru[8]; do { bool OK = true; int copy[8]; for (int i = 0; i < a; i++)copy[i] = b[i]; memset(aru, true, sizeof(aru)); for (int i = 0; i < a; i++) {//c[i]体目がゴールする vector<P>V; for (int j = 0; j < a; j++) { if (aru[j] && copy[j] < copy[c[i]]) { V.push_back(P(copy[j], j)); } } sort(V.begin(), V.end(), greater<P>()); for (int k = 0; k + 1 < (int)V.size(); k++) { if (V[k].first - 1 <= V[k + 1].first) { V[k + 1].first = V[k].first - 2; } } for (int k = 0; k < V.size(); k++) { copy[V[k].second] = V[k].first; if (V[k].first <= 0)OK = false; } aru[c[i]] = false; } if (OK) { S++; } } while (next_permutation(c, c + a)); cout << S << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - Row to Column |
User | naoki2016 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1064 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | Subtask | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | 0 / 1000 | ||||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt |
Subtask | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 2_00.txt, 2_01.txt, 2_02.txt, 2_03.txt, 2_04.txt, 2_05.txt, 2_06.txt, 2_07.txt, 2_08.txt, 2_09.txt, 2_10.txt, 2_11.txt, 2_12.txt, 2_13.txt, 2_14.txt, 2_15.txt, 2_16.txt, 2_17.txt, 2_18.txt, 2_19.txt, 2_20.txt, 2_21.txt, 2_22.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | WA | 1 ms | 256 KB |
0_01.txt | WA | 1 ms | 256 KB |
0_02.txt | WA | 1 ms | 256 KB |
0_03.txt | AC | 1 ms | 256 KB |
0_04.txt | WA | 1 ms | 256 KB |
1_00.txt | WA | 1 ms | 256 KB |
1_01.txt | WA | 1 ms | 256 KB |
1_02.txt | WA | 1 ms | 256 KB |
1_03.txt | WA | 1 ms | 256 KB |
1_04.txt | WA | 1 ms | 256 KB |
1_05.txt | WA | 1 ms | 256 KB |
1_06.txt | WA | 1 ms | 256 KB |
1_07.txt | WA | 1 ms | 256 KB |
1_08.txt | WA | 1 ms | 256 KB |
1_09.txt | WA | 1 ms | 256 KB |
1_10.txt | WA | 1 ms | 256 KB |
1_11.txt | WA | 1 ms | 256 KB |
1_12.txt | WA | 1 ms | 256 KB |
1_13.txt | AC | 1 ms | 256 KB |
1_14.txt | WA | 1 ms | 256 KB |
2_00.txt | WA | 1 ms | 256 KB |
2_01.txt | WA | 1 ms | 256 KB |
2_02.txt | WA | 1 ms | 256 KB |
2_03.txt | WA | 1 ms | 256 KB |
2_04.txt | WA | 1 ms | 256 KB |
2_05.txt | WA | 1 ms | 256 KB |
2_06.txt | WA | 1 ms | 256 KB |
2_07.txt | WA | 1 ms | 256 KB |
2_08.txt | WA | 1 ms | 256 KB |
2_09.txt | WA | 1 ms | 256 KB |
2_10.txt | WA | 1 ms | 256 KB |
2_11.txt | WA | 1 ms | 256 KB |
2_12.txt | WA | 1 ms | 256 KB |
2_13.txt | WA | 1 ms | 256 KB |
2_14.txt | WA | 1 ms | 256 KB |
2_15.txt | WA | 1 ms | 256 KB |
2_16.txt | WA | 1 ms | 256 KB |
2_17.txt | WA | 1 ms | 256 KB |
2_18.txt | WA | 1 ms | 256 KB |
2_19.txt | WA | 1 ms | 256 KB |
2_20.txt | WA | 1 ms | 256 KB |
2_21.txt | WA | 1 ms | 256 KB |
2_22.txt | WA | 1 ms | 256 KB |