Submission #732316

# Submission time Handle Problem Language Result Execution time Memory
732316 2023-04-29T01:26:23 Z vjudge1 Baloni (COCI15_baloni) C++17
0 / 100
2000 ms 7400 KB
#include <bits/stdc++.h>
#define sts stable_sort
#define B begin()
#define rB rbegin()
#define E end()
#define rE rend()
#define F first
#define S second
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long

using namespace std;

const int MAXN = 1e4 + 4;
const int MOD = 1e9 + 7;
const ll INF = 9223372036854775807LL;
const ll inf = 2147483647;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    int n; cin >> n;
    vector<int> v(n);

    for(int i = 0; i < n; i++){
        cin >> v[i];
    }

    vector<int> ans;

    for(int i = 0; i < n; i++){
        bool a = 0;

        for(int j = 0; j < ans.size(); j++){
            if(v[i] < ans[j]){
                ans[j] = v[i];
                a = 1;
                break;
            }
        }
        if(!a){
            ans.pb(v[i]);
        }
        sort(ans.rbegin(), ans.rend());
    }

    cout << ans.size() << "\n";

    return 0;
}
/**



**/

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int j = 0; j < ans.size(); j++){
      |                        ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 212 KB Output isn't correct
2 Incorrect 13 ms 324 KB Output isn't correct
3 Incorrect 57 ms 344 KB Output isn't correct
4 Incorrect 91 ms 344 KB Output isn't correct
5 Execution timed out 2011 ms 7112 KB Time limit exceeded
6 Execution timed out 2064 ms 7400 KB Time limit exceeded
7 Execution timed out 2039 ms 6200 KB Time limit exceeded
8 Execution timed out 2072 ms 6268 KB Time limit exceeded
9 Execution timed out 2085 ms 6492 KB Time limit exceeded
10 Execution timed out 2061 ms 6612 KB Time limit exceeded