提出 #74874548
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template<class T> inline bool chmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
const int MOD = 1e9 + 7;
void solve() {
int n,x;cin>>n>>x;
int prev=-100;
for(int i=0;i<=n;i++){
int a;cin>>a;
if(abs(a-prev)>=x){
cout<<i<<' '<<a<<'\n';
prev=a;
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Sensor Data Logging |
| ユーザ | lavi3 |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 200 |
| コード長 | 850 Byte |
| 結果 | AC |
| 実行時間 | 2 ms |
| メモリ | 3644 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt |
| All | sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01.txt | AC | 2 ms | 3548 KiB |
| test_01.txt | AC | 1 ms | 3548 KiB |
| test_02.txt | AC | 1 ms | 3472 KiB |
| test_03.txt | AC | 1 ms | 3560 KiB |
| test_04.txt | AC | 1 ms | 3596 KiB |
| test_05.txt | AC | 1 ms | 3504 KiB |
| test_06.txt | AC | 1 ms | 3644 KiB |
| test_07.txt | AC | 1 ms | 3576 KiB |
| test_08.txt | AC | 1 ms | 3560 KiB |
| test_09.txt | AC | 1 ms | 3496 KiB |
| test_10.txt | AC | 1 ms | 3576 KiB |
| test_11.txt | AC | 1 ms | 3644 KiB |
| test_12.txt | AC | 1 ms | 3584 KiB |
| test_13.txt | AC | 1 ms | 3500 KiB |