답안 #37184

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
37184 2017-12-22T09:52:16 Z Ulugbek_Abdimanabov Money (IZhO17_money) C++14
0 / 100
0 ms 21548 KB
//Solution by Zhusupov Nurlan
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef map<string , int> MSI;
typedef vector<int> VI;
typedef pair<int, int> PII;

#define endl '\n'
#define pb(x) push_back(x)
#define sqr(x) ((x) * (x))
#define F first
#define S second
#define SZ(t) ((int) t.size())
#define len(t) ((int) t.length())
#define base LL(1e9 + 7)
#define fname "money."
#define sz 1000 * 1000
#define EPS (1e-8)
#define INF ((int)1e9 + 9)
#define mp make_pair

int n, a[sz], ans, d[sz], was[sz];
PII b[sz];

int main()
{
    freopen(fname"in", "r", stdin);
    freopen(fname"out", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      d[i] = INF;
    }

    for (int i = 1; i <= n; i++) {
      int l = 0, r = n + 1;
      while (r - l > 1) {
        int m = (l + r) >> 1;
        if (a[i] <= d[m])
          r = m;
        else
          l = m;
      }
        ans = max(ans, r);
        d[r] = a[i];
    }
    cout << ans << "\n";
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:30:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen(fname"in", "r", stdin);
                                   ^
money.cpp:31:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen(fname"out", "w", stdout);
                                     ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 21548 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 21548 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 21548 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 21548 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -