답안 #1096587

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1096587 2024-10-04T20:38:47 Z Uniq0rn 걷기 (NOI12_walking) C++14
25 / 25
1 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ld long double 
#define ll long long int
#define pi pair<int,int>
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    double l;int n;
    cin >> l >> n;
    vector<pair<double,double>> a(n);
    for(auto &[x,y]:a){
        cin >>x >> y;
    }
    sort(a.rbegin(),a.rend());
    vector<double> lis;
    for(auto [x,y]:a){
        double t = x + l/y;
        auto it = lower_bound(all(lis),t) - lis.begin();
        if(it != sz(lis)){
            lis[it] = t;
        }
        else lis.push_back(t);
    }
    cout << sz(lis);
    return 0;
}

Compilation message

walking.cpp: In function 'int main()':
walking.cpp:16:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     for(auto &[x,y]:a){
      |               ^
walking.cpp:21:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |     for(auto [x,y]:a){
      |              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 420 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct