답안 #778281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778281 2023-07-10T08:11:15 Z RecursiveCo Magic Tree (CEOI19_magictree) C++14
0 / 100
27 ms 2628 KB
// CF template, version 3.0

#include <bits/stdc++.h>

using namespace std;

#define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0)
#define getTest int t; cin >> t
#define eachTest for (int _var=0;_var<t;_var++)
#define get(name) int (name); cin >> (name)
#define out(o) cout << (o)
#define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
#define sortl(name) sort((name).begin(), (name).end())
#define rev(name) reverse((name).begin(), (name).end())
#define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
#define decision(b) if (b){out("YES");}else{out("NO");}

#define int long long int

signed main() {
    improvePerformance;
    get(n);
    get(m);
    get(k);
    forto(n-1, i) {
        get(cur);
    }
    vector<int> pos(n, -1);
    forto(m, i) {
        get(v);
        get(d);
        get(w);
        pos[--v] = d;
    }
    vector<int> arr;
    forto(n, i) {
        if (pos[i] != -1) arr.push_back(pos[i]);
    }
    rev(arr);
    vector<int> dp(m, 1e18);
    int L = arr.size();
    forto(L, i) {
        dp[lower_bound(dp.begin(), dp.end(), arr[i]) - dp.begin()] = arr[i];
    }
    int ans = 0;
    forto(m, i) {
        if (dp[i] != 1e18) ans = i + 1;
        else break;
    }
    out(ans);
}

Compilation message

magictree.cpp: In function 'int main()':
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'n' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:22:5: note: in expansion of macro 'get'
   22 |     get(n);
      |     ^~~
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'm' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:23:5: note: in expansion of macro 'get'
   23 |     get(m);
      |     ^~~
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:24:5: note: in expansion of macro 'get'
   24 |     get(k);
      |     ^~~
magictree.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
magictree.cpp:25:5: note: in expansion of macro 'forto'
   25 |     forto(n-1, i) {
      |     ^~~~~
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'cur' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:26:9: note: in expansion of macro 'get'
   26 |         get(cur);
      |         ^~~
magictree.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
magictree.cpp:29:5: note: in expansion of macro 'forto'
   29 |     forto(m, i) {
      |     ^~~~~
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'v' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:30:9: note: in expansion of macro 'get'
   30 |         get(v);
      |         ^~~
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'd' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:31:9: note: in expansion of macro 'get'
   31 |         get(d);
      |         ^~~
magictree.cpp:10:23: warning: unnecessary parentheses in declaration of 'w' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
magictree.cpp:32:9: note: in expansion of macro 'get'
   32 |         get(w);
      |         ^~~
magictree.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
magictree.cpp:36:5: note: in expansion of macro 'forto'
   36 |     forto(n, i) {
      |     ^~~~~
magictree.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
magictree.cpp:42:5: note: in expansion of macro 'forto'
   42 |     forto(L, i) {
      |     ^~~~~
magictree.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
magictree.cpp:46:5: note: in expansion of macro 'forto'
   46 |     forto(m, i) {
      |     ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 1624 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 2628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -