Submission #114258

# Submission time Handle Problem Language Result Execution time Memory
114258 2019-05-31T15:28:42 Z rajarshi_basu Bubble Sort 2 (JOI18_bubblesort2) C++14
17 / 100
9000 ms 640 KB
#include <iostream>
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <complex>
#include <stack>
#include <set>
#include "bubblesort2.h"
#include <fstream>

#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
#define vi vector<int>
#define v vector
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define cd complex<double> 
#define iil pair<ii,ll>
#define v vector


const int MAXN = 5e5+10;
const int INF = 1e9+5;
using namespace std;
//int n,k;

int arr[MAXN];
int rgt[MAXN];

vi countScans(vi ar,vi xx,vi vals){
	int n = ar.size();
	FOR(i,n)arr[i] = ar[i];
	int q = vals.size();
	vi ans(q);
	FOR(i,q){
		arr[xx[i]] = vals[i];
		int mx = 0;
		FOR(i,n){
			int ctr = 0;
			FOR(j,i){
				if(arr[j] > arr[i])ctr++;
			}
			mx = max(mx, ctr);
		}
		ans[i] = mx;
	}
	return ans;
}
/*
int main(){
	int n,q;
	cin >> n >> q;
	v<int> ar(n);
	
	FOR(i,n){
		cin >> ar[i];
	}
	v<int> x(q),vals(q);
	x.reserve(q);
	vals.reserve(q);

	FOR(i,q){
		cin >> x[i] >> vals[i];
	}

	
	vi ret = countScans(ar,x,vals);
	FOR(i,q)cout << ret[i] << " ";cout << endl;
	return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Correct 75 ms 384 KB Output is correct
2 Correct 202 ms 504 KB Output is correct
3 Correct 3013 ms 436 KB Output is correct
4 Correct 2843 ms 504 KB Output is correct
5 Correct 2832 ms 504 KB Output is correct
6 Correct 2840 ms 504 KB Output is correct
7 Correct 3049 ms 504 KB Output is correct
8 Correct 2850 ms 504 KB Output is correct
9 Correct 3142 ms 384 KB Output is correct
10 Correct 3077 ms 512 KB Output is correct
11 Correct 3014 ms 504 KB Output is correct
12 Correct 3009 ms 604 KB Output is correct
13 Correct 2836 ms 632 KB Output is correct
14 Correct 3030 ms 512 KB Output is correct
15 Correct 3028 ms 504 KB Output is correct
16 Correct 2821 ms 468 KB Output is correct
17 Correct 2946 ms 504 KB Output is correct
18 Correct 2871 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 384 KB Output is correct
2 Correct 202 ms 504 KB Output is correct
3 Correct 3013 ms 436 KB Output is correct
4 Correct 2843 ms 504 KB Output is correct
5 Correct 2832 ms 504 KB Output is correct
6 Correct 2840 ms 504 KB Output is correct
7 Correct 3049 ms 504 KB Output is correct
8 Correct 2850 ms 504 KB Output is correct
9 Correct 3142 ms 384 KB Output is correct
10 Correct 3077 ms 512 KB Output is correct
11 Correct 3014 ms 504 KB Output is correct
12 Correct 3009 ms 604 KB Output is correct
13 Correct 2836 ms 632 KB Output is correct
14 Correct 3030 ms 512 KB Output is correct
15 Correct 3028 ms 504 KB Output is correct
16 Correct 2821 ms 468 KB Output is correct
17 Correct 2946 ms 504 KB Output is correct
18 Correct 2871 ms 504 KB Output is correct
19 Execution timed out 9047 ms 640 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9040 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 75 ms 384 KB Output is correct
2 Correct 202 ms 504 KB Output is correct
3 Correct 3013 ms 436 KB Output is correct
4 Correct 2843 ms 504 KB Output is correct
5 Correct 2832 ms 504 KB Output is correct
6 Correct 2840 ms 504 KB Output is correct
7 Correct 3049 ms 504 KB Output is correct
8 Correct 2850 ms 504 KB Output is correct
9 Correct 3142 ms 384 KB Output is correct
10 Correct 3077 ms 512 KB Output is correct
11 Correct 3014 ms 504 KB Output is correct
12 Correct 3009 ms 604 KB Output is correct
13 Correct 2836 ms 632 KB Output is correct
14 Correct 3030 ms 512 KB Output is correct
15 Correct 3028 ms 504 KB Output is correct
16 Correct 2821 ms 468 KB Output is correct
17 Correct 2946 ms 504 KB Output is correct
18 Correct 2871 ms 504 KB Output is correct
19 Execution timed out 9047 ms 640 KB Time limit exceeded
20 Halted 0 ms 0 KB -