結果
| 問題 |
No.3091 The Little Match Boy
|
| コンテスト | |
| ユーザー |
seren
|
| 提出日時 | 2025-04-06 15:35:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 2,529 bytes |
| コンパイル時間 | 4,531 ms |
| コンパイル使用メモリ | 254,548 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2025-04-06 15:35:36 |
| 合計ジャッジ時間 | 6,916 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 62 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
//*
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
// using mint = modint1000000007;
//*/
using ll = long long;
using i128 = __int128_t;
using pll = pair<ll, ll>;
using tlll = tuple<ll, ll, ll>;
using ld = long double;
const int INF = 1000100100;
const ll INFF = 1000100100100100100LL;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(i, n) for (ll i = 0; i < ll(n); i++)
#define rep2(i, l, r) for (ll i = ll(l); i < ll(r); i++)
#define rep3(i, l, r, d) for (ll i = ll(l); (d) > 0 ? i < ll(r) : i > ll(r); i += d)
#define rep(...) overload4(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
#define per(i, n) for (int i = (n) - 1; i >= 0; --i)
#define yesno(f) cout << (f ? "Yes" : "No") << endl;
#define YESNO(f) cout << (f ? "YES" : "NO") << endl;
#define all(a) (a).begin(), (a).end()
#define popc(x) __builtin_popcountll(ll(x))
template <typename S, typename T>
ostream &operator<<(ostream &os, const pair<S, T> &p) {
return os << p.first << ' ' << p.second;
}
template <typename T>
void printvec(const vector<T> &v) {
int n = v.size();
rep(i, n) cout << v[i] << (i == n - 1 ? "" : " ");
cout << '\n';
}
template <typename T>
void printvect(const vector<T> &v) {
for (auto &vi : v) cout << vi << '\n';
}
template <typename T>
void printvec2(const vector<vector<T>> &v) {
for (auto &vi : v) printvec(vi);
}
template <typename S, typename T>
bool chmax(S &x, const T &y) {
return (x < y) ? (x = y, true) : false;
}
template <typename S, typename T>
bool chmin(S &x, const T &y) {
return (x > y) ? (x = y, true) : false;
}
#ifdef LOCAL // https://zenn.dev/sassan/articles/19db660e4da0a4
#include "cpp-dump-main/dump.hpp"
#define dump(...) cpp_dump(__VA_ARGS__)
CPP_DUMP_DEFINE_DANGEROUS_EXPORT_OBJECT(val());
#else
#define dump(...)
#endif
struct io_setup {
io_setup() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout << fixed << setprecision(15);
}
} io_setup;
void solve() {
int n, m;
cin >> n >> m;
vector<int> s(m);
rep(i, m) cin >> s[i], s[i]--;
vector<int> v(n);
iota(all(v), 0);
set<pll> S;
rep(i, m) {
S.emplace(min(v[s[i]], v[s[i] + 1]), max(v[s[i]], v[s[i] + 1]));
swap(v[s[i]], v[s[i] + 1]);
dump(v);
}
cout << (int)S.size() << endl;
}
int main() {
int t;
// cin >> t;
t = 1;
while (t--) {
solve();
}
}
seren