結果
| 問題 |
No.3324 ハイライト動画
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2025-11-10 11:57:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 990 bytes |
| コンパイル時間 | 2,946 ms |
| コンパイル使用メモリ | 285,296 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-10 11:58:00 |
| 合計ジャッジ時間 | 6,063 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; }
bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; }
template<typename T>
vector<pair<T, int>> run_length_encoding(const vector<T> &v) {
vector<pair<T, int>> res;
for (const auto &x : v) {
if (res.empty() || res.back().first != x) {
res.emplace_back(x, 0);
}
res.back().second++;
}
return res;
}
vector<pair<char, int>> run_length_encoding(const string &s) {
return run_length_encoding(vector<char>(s.begin(), s.end()));
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, M;
cin >> N >> M;
vector<int> A(M);
for (int i = 0; i < M; i++) cin >> A[i], A[i] -= i;
auto P = run_length_encoding(A);
cout << P.size() << '\n';
int k = 0;
for (auto [a, l] : P) {
cout << a + k << ' ' << l << '\n';
k += l;
}
}
nonon