Submission #61253
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i > (n); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) #define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i) //降順はgreater<T>() #define all(x) (x).begin(), (x).end() #define rv(s) reverse((s).begin(), (s).end()) // gcd lcmはそのままok #define gcd(a, b) __gcd(a, b) #define bits(n) (1LL << (n)) #define pcnt(x) __builtin_popcountll(x) //配列内等要素削除 #define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end()) #define Fixed(n) fixed << setprecision(n) //総和 #define sowa(n) (((n) * ((n) + 1)) / 2) #define pb(x, a) (x).push_back(a) #define fb(x, a) (x).push_front(a) #define eb(x, a) (x).emplace_back(a) #define cauto const auto & using P = pair< int , int >; using Graph = vector<vector<P>>; template < class T> //昇順 using min_heap = priority_queue<T, vector<T>, greater<T>>; template < class T> //降順 using max_heap = priority_queue<T>; template < class A, class B> using umap = unordered_map<A, B>; template < class A> using uset = unordered_set<A>; template < typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { //多次元初期化 std::fill((T *)array, (T *)(array + N), val); } template < class A, class B> bool chmax(A &a, const B &b) { //最大値更新 返り値はbool if (a < b) { a = b; return 1; } return 0; } template < class A, class B> bool chmin(A &a, const B &b) { //最小値更新 返り値はbool if (b < a) { a = b; return 1; } return 0; } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; constexpr int INF = 0x3f3f3f3f; constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr int mod1 = 1e9 + 7; constexpr int mod2 = 998244353; //} END signed main( void ) { ios_base::sync_with_stdio( false ); int n, q; cin >> n >> q; vector< int > x(n), y(n, INF); arep(i, x) cin >> i; y[0] = x[0]; rep(i, 1, n) y[i] = min(y[i - 1], x[i]); rep(i, 0, q) { int a; cin >> a; --a; cout << y[a] << '\n' ; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 1356 - Minimum Value |
ユーザー名 | immunity |
投稿日時 | 2020-07-26 20:45:13 |
言語 | C++17 |
状態 | Accepted |
得点 | 30 |
ソースコード長 | 2283 Byte |
最大実行時間 | 455 ms |
最大メモリ使用量 | 25768 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | task01 | 10 / 10 | in01*, sample01.txt |
2 | task02 | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
in01_01.txt | AC | 31 ms | 600 KB |
1
|
2
|
in01_02.txt | AC | 24 ms | 408 KB |
1
|
2
|
in01_03.txt | AC | 28 ms | 484 KB |
1
|
2
|
in01_04.txt | AC | 26 ms | 544 KB |
1
|
2
|
in01_05.txt | AC | 22 ms | 612 KB |
1
|
2
|
in01_06.txt | AC | 31 ms | 676 KB |
1
|
2
|
in01_07.txt | AC | 28 ms | 616 KB |
1
|
2
|
in01_08.txt | AC | 28 ms | 680 KB |
1
|
2
|
in01_09.txt | AC | 29 ms | 612 KB |
1
|
2
|
in01_10.txt | AC | 20 ms | 672 KB |
1
|
2
|
in01_11.txt | AC | 22 ms | 608 KB |
1
|
2
|
in01_12.txt | AC | 29 ms | 676 KB |
1
|
2
|
in01_13.txt | AC | 23 ms | 736 KB |
1
|
2
|
in02_01.txt | AC | 159 ms | 2584 KB |
2
|
|
in02_02.txt | AC | 199 ms | 5336 KB |
2
|
|
in02_03.txt | AC | 58 ms | 5528 KB |
2
|
|
in02_04.txt | AC | 455 ms | 7760 KB |
2
|
|
in02_05.txt | AC | 409 ms | 9956 KB |
2
|
|
in02_06.txt | AC | 427 ms | 12028 KB |
2
|
|
in02_07.txt | AC | 411 ms | 14356 KB |
2
|
|
in02_08.txt | AC | 408 ms | 17584 KB |
2
|
|
in02_09.txt | AC | 410 ms | 18624 KB |
2
|
|
in02_10.txt | AC | 404 ms | 20696 KB |
2
|
|
in02_11.txt | AC | 425 ms | 22900 KB |
2
|
|
in02_12.txt | AC | 422 ms | 25360 KB |
2
|
|
in02_13.txt | AC | 412 ms | 25768 KB |
2
|
|
sample01.txt | AC | 17 ms | 22596 KB |
1
|
2
|