이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define Anhminh int main()
#define ll long long
#define nl "\n"
#define TASK "test"
#define TASK1 "geus"
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define se second
#define MASK(n) (1ll << n) //2^n
#define BIT(x,i) ((x >> i) & 1ll) //bit thu i cua x
#define For(i, a, b) for (int i = a; i <= b; i++)
#define Ford(i, b, a) for (int i = b; i >= a; i--)
const int MAX = 2e5 + 5;
const int mod = 1e9 + 7;
const int d4x[4] = {-1, 0, 1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int d8y[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int n, d, a[MAX], res;
vector <int> lis(MAX, mod);
vector <int> lis2;
//int len(int l, int r){
//
//}
void inp(){
cin >> n >> d;
For(i, 1, n) cin >> a[i];
lis.pb(-mod);
lis2.pb(-mod);
For(i, 1, n){
int it = lower_bound(lis.begin(), lis.end(), a[i]) - lis.begin();
lis[it] = a[i];
// int ct = lower_bound(lis2.begin(), lis2.end(), it) - lis2.begin();
res = max(res, it);
}
cout << res + 1;
// lis2[0] = 1;
// For(it, 1, lis2.size()){
// if (lis2[it] - lis2[it - 1] > 1){
//
// }
// }
}
void solve(){
}
Anhminh {
if(fopen(TASK".inp","r")){
freopen(TASK".inp","r",stdin);
freopen(TASK".out","w",stdout);
}
if(fopen(TASK1".inp","r")){
freopen(TASK1".inp","r",stdin);
freopen(TASK1".out","w",stdout);
}
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t = 1; ///cin >> t;
while(t--){
inp();
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
glo.cpp: In function 'int main()':
glo.cpp:61:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
61 | freopen(TASK".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
glo.cpp:62:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
62 | freopen(TASK".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
glo.cpp:65:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
65 | freopen(TASK1".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
glo.cpp:66:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
66 | freopen(TASK1".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |