Submission #546671

# Submission time Handle Problem Language Result Execution time Memory
546671 2022-04-08T04:30:00 Z ac2hu Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#ifdef DEBUG
#include "../templates/debug.h"
#else 
#define deb(x...)
#endif
using namespace std;
signed main() {
	iostream::sync_with_stdio(false);
	cin.tie(nullptr);cout.tie(nullptr);
    int n,m;cin >> n >> m;
    vector<int> a(n);
    for(auto &e : a)cin >> e;
    for(int i = 0;i<n;i++)
        a[i] = (i + 1)*m - a[i];
    deb(a);
    vector<int> temp;
    for(int e : a){
        int p = upper_bound(temp.begin(), temp.end(), e) - temp.begin();
        if(p == temp.size())
            temp.push_back(e);
        else
            temp[p] = e;
    }
    cout << n - temp.size() << "\n";
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:20:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         if(p == temp.size())
      |            ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -