結果
問題 |
No.1077 Noelちゃんと星々4
|
ユーザー |
|
提出日時 | 2020-06-12 21:49:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,583 bytes |
コンパイル時間 | 1,431 ms |
コンパイル使用メモリ | 117,512 KB |
最終ジャッジ日時 | 2025-01-11 02:28:06 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 1 WA * 19 |
ソースコード
// // main.cpp // AtCoder // // Created by atsushi on 2019/12/29. // #include <iostream> #include <vector> #include <set> #include <string> #include <utility> #include <functional> #include <queue> #include <cmath> #include <map> #include <unordered_map> #include <unordered_set> #include <iomanip> // std::setprecision #include <bitset> #define REP(i, N) for(int i=0; i<(N); i++) #define ALL(N) (N).begin(), (N).end() #define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__) using namespace std; using ll = long long; template<typename T> class in { T value; public: in() { cin >> value; } operator const T&() const { return value; } operator T&() { return value; } in& operator=(T source) { value = source; return *this; } }; template<> class in<string> : public string { public: in() { cin >> *this; } }; template<class T> class inseq : public T { public: template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; } }; template<class T> using invec = inseq<vector<T>>; auto solve() { in<ll> N; invec<ll> I(N); ll r = 0; for (int i = N - 1; i >= 1; i--) { if (I[i-1] > I[i]) { r += I[i-1] - I[i]; } } return r; } template<typename T> void plot(const T& func) { cout << func() << endl; } template<> void plot<void()>(void(&func)()) { func(); } template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; } int main(int argc, const char * argv[]) { // insert code here... plot(solve); return 0; }