結果
| 問題 |
No.3324 ハイライト動画
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-11-05 19:06:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 58,316 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-11-05 19:06:07 |
| 合計ジャッジ時間 | 4,372 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%d%d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:33:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
33 | for (int i = 0; i < m; i++) scanf("%d", as + i);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 3324.cc: No.3324 繝上う繝ゥ繧、繝亥虚逕サ - yukicoder
*/
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
/* constant */
const int MAX_M = 200000;
/* typedef */
using pii = pair<int,int>;
using vpii = vector<pii>;
/* global variables */
int as[MAX_M];
/* subroutines */
/* main */
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++) scanf("%d", as + i);
vpii fs;
for (int i = 0; i < m;) {
int j = i++;
while (i < n && as[i - 1] + 1 == as[i]) i++;
fs.push_back({as[j], i - j});
}
printf("%d\n", (int)fs.size());
for (auto [si, li]: fs) printf("%d %d\n", si, li);
return 0;
}
tnakao0123