Submission #649479

# Submission time Handle Problem Language Result Execution time Memory
649479 2022-10-10T09:30:33 Z BackNoob Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
4503 ms 170296 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define MASK(i) (1LL << (i))
#define ull unsigned long long
#define ld long double
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define BIT(x , i) ((x >> (i)) & 1)
#define TASK "task"
#define sz(s) (int) (s).size()

using namespace std;
const int mxN = 5e5 + 227;
const int inf = 1e9 + 277;
const int mod = 1e9 + 7;
const ll infll = 1e18 + 7;
const int base = 307;
const int LOG = 20;

template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
	if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
	if (a < b) {a = b; return true;} return false;
}

vector<int> countScans(vector<int> a, vector<int> q1, vector<int> q2)
{
    vector<int> ans;
    for(int i = 0; i < sz(q1); i++) {
        int pos = q1[i];
        int val = q2[i];
        a[pos] = val;
        int cur = inf;
        int res = 0;
        for(int i = 0; i < sz(a); i++) cout << a[i] << ' ';
        cout << endl;
        for(int i = sz(a) - 1; i >= 0; i--) {
            if(a[i] > cur) ++res;
            minimize(cur, a[i]);
        }
        ans.pb(res);
    }
    return ans;
}

//void solve()
//{
//    vector<int> a;
//    vector<int> q1;
//    vector<int> q2;
//    int n;
//    cin >> n;
//    for(int i = 1; i <= n; i++) {
//        int x;
//        cin >> x;
//        a.pb(x);
//    }
//
//
//    int q;
//    cin >> q;
//    for(int i = 1; i <= q; i++) {
//        int p, v;
//        cin >> p >> v;
//        q1.pb(p);
//        q2.pb(v);
//    }
//    vector<int> res = countScans(a, q1, q2);
//    for(auto it : res) cout << it << endl;
//}
//
//int main()
//{
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    freopen(TASK".inp" , "r" , stdin);
//    freopen(TASK".out" , "w" , stdout);
//
//    int tc = 1;
//    //cin >> tc;
//    while(tc--) {
//    	solve();
//    }
//    return 0;
//}
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 3184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 3184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4503 ms 170296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 3184 KB Output isn't correct
2 Halted 0 ms 0 KB -