## 답안 #957172

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957172 2024-04-03T06:19:07 Z NeroZein Misspelling (JOI22_misspelling) C++17
28 / 100
4000 ms 87512 KB
```#include "bits/stdc++.h"
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif

const int A = 26;
const int N = 5e5 + 5;
const int md = (int) 1e9 + 7;

int dp[N][A];
vector<int> smaller[N], bigger[N];

void add(int& a, int b) {
a += b;
if (a >= md) a -= md;
}

int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int a, b;
cin >> a >> b;
if (a < b) {
smaller[a].push_back(a);//1
smaller[b].push_back(-a);//1
} else {
bigger[b].push_back(b);//2
bigger[a].push_back(-b);//2
}
}
for (int i = 0; i < A; ++i) {
dp[1][i] = 1;
}
vector<multiset<int>> se(3);
for (int i = 1; i <= n; ++i) {
int mx1 = 0, mx2 = 0;
if (!se[1].empty()) mx1 = max(0, *se[1].rbegin());
if (!se[2].empty()) mx2 = max(0, *se[2].rbegin());
int mx = max(mx1, mx2);
int mn = min(mx1, mx2);
for (int j = 0; j < A; ++j) {
for (int l = 0; l < A; ++l) {
for (int k = mx + 1; k < i; ++k) {
if (l != j) {
}
}
int st = (mx1 == mx ? 1 : 0) | (mx2 == mx ? 2 : 0);
for (int k = mn + 1; k <= mx; ++k) {
add(dp[i][j], dp[k][l] * (st & 1 ? l < j: 1) * (st & 2 ? l > j : 1));
}
}
}
for (int x : smaller[i]) {
if (x > 0) se[1].insert(x);
else se[1].erase(se[1].find(-x));
}
for (int x : bigger[i]) {
if (x > 0) se[2].insert(x);
else se[2].erase(se[2].find(-x));
}
}
int ans = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < A; ++j) {
}
}
cout << ans << '\n';
return 0;
}
```

#### Subtask #1 8.0 / 8.0

# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 6 ms 25180 KB Output is correct
3 Correct 6 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 6 ms 25180 KB Output is correct
6 Correct 6 ms 25260 KB Output is correct
7 Correct 7 ms 25176 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 7 ms 25508 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 6 ms 25472 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25180 KB Output is correct

#### Subtask #2 20.0 / 20.0

# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 6 ms 25180 KB Output is correct
3 Correct 6 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 6 ms 25180 KB Output is correct
6 Correct 6 ms 25260 KB Output is correct
7 Correct 7 ms 25176 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 7 ms 25508 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 6 ms 25472 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25180 KB Output is correct
15 Correct 26 ms 25176 KB Output is correct
16 Correct 14 ms 25180 KB Output is correct
17 Correct 10 ms 25176 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 9 ms 25272 KB Output is correct
20 Correct 7 ms 25180 KB Output is correct
21 Correct 7 ms 25180 KB Output is correct
22 Correct 9 ms 25680 KB Output is correct
23 Correct 23 ms 25428 KB Output is correct
24 Correct 12 ms 25176 KB Output is correct
25 Correct 7 ms 25180 KB Output is correct

#### Subtask #3 0 / 29.0

# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25260 KB Output is correct
2 Correct 6 ms 25180 KB Output is correct
3 Correct 6 ms 25176 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Execution timed out 4082 ms 87512 KB Time limit exceeded
6 Halted 0 ms 0 KB -

#### Subtask #4 0 / 32.0

# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 6 ms 25180 KB Output is correct
3 Correct 6 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 6 ms 25180 KB Output is correct
6 Correct 6 ms 25260 KB Output is correct
7 Correct 7 ms 25176 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 7 ms 25508 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 6 ms 25472 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25180 KB Output is correct
15 Correct 26 ms 25176 KB Output is correct
16 Correct 14 ms 25180 KB Output is correct
17 Correct 10 ms 25176 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 9 ms 25272 KB Output is correct
20 Correct 7 ms 25180 KB Output is correct
21 Correct 7 ms 25180 KB Output is correct
22 Correct 9 ms 25680 KB Output is correct
23 Correct 23 ms 25428 KB Output is correct
24 Correct 12 ms 25176 KB Output is correct
25 Correct 7 ms 25180 KB Output is correct
26 Correct 63 ms 26800 KB Output is correct
27 Execution timed out 4019 ms 26068 KB Time limit exceeded
28 Halted 0 ms 0 KB -

#### Subtask #5 0 / 11.0

# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25176 KB Output is correct
2 Correct 6 ms 25180 KB Output is correct
3 Correct 6 ms 25180 KB Output is correct
4 Correct 6 ms 25180 KB Output is correct
5 Correct 6 ms 25180 KB Output is correct
6 Correct 6 ms 25260 KB Output is correct
7 Correct 7 ms 25176 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 7 ms 25508 KB Output is correct
11 Correct 6 ms 25180 KB Output is correct
12 Correct 6 ms 25472 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25180 KB Output is correct
15 Correct 26 ms 25176 KB Output is correct
16 Correct 14 ms 25180 KB Output is correct
17 Correct 10 ms 25176 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 9 ms 25272 KB Output is correct
20 Correct 7 ms 25180 KB Output is correct
21 Correct 7 ms 25180 KB Output is correct
22 Correct 9 ms 25680 KB Output is correct
23 Correct 23 ms 25428 KB Output is correct
24 Correct 12 ms 25176 KB Output is correct
25 Correct 7 ms 25180 KB Output is correct
26 Correct 6 ms 25260 KB Output is correct
27 Correct 6 ms 25180 KB Output is correct
28 Correct 6 ms 25176 KB Output is correct
29 Correct 6 ms 25180 KB Output is correct
30 Execution timed out 4082 ms 87512 KB Time limit exceeded
31 Halted 0 ms 0 KB -