Submission #430244

# Submission time Handle Problem Language Result Execution time Memory
430244 2021-06-16T12:27:15 Z vulpes2 Bubble Sort 2 (JOI18_bubblesort2) C++17
17 / 100
9000 ms 1484 KB
//#include <atcoder/maxflow.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 

#include <iostream>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <iterator>
#include <random>
#include <chrono>
#include <complex>
#include <bitset>
#include <fstream>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

 
//using namespace __gnu_pbds;
//using namespace atcoder;
using namespace std;

const ll modd = (1000LL * 1000LL * 1000LL + 7LL);
//const ll modd = 998244353;

std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
	int Q=X.size();
	std::vector<int> answer(Q);
	for (int j=0;j<Q;j++) {
        A[X[j]] = V[j];
        int ans = 0;
        vector<int> a_copy(A.begin(), A.end());
        sort(a_copy.begin(), a_copy.end());
        forr(i,0,A.size()) {
            int k = upper_bound(a_copy.begin(), a_copy.end(), A[i]) - a_copy.begin();
            --k;
            ans = max(ans, i-k);
        }
		answer[j]=ans;
	}
	return answer;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:29:53: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 | #define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
      |                                                     ^
bubblesort2.cpp:54:9: note: in expansion of macro 'forr'
   54 |         forr(i,0,A.size()) {
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Correct 30 ms 204 KB Output is correct
2 Correct 75 ms 312 KB Output is correct
3 Correct 501 ms 380 KB Output is correct
4 Correct 507 ms 380 KB Output is correct
5 Correct 468 ms 384 KB Output is correct
6 Correct 359 ms 384 KB Output is correct
7 Correct 416 ms 384 KB Output is correct
8 Correct 422 ms 332 KB Output is correct
9 Correct 502 ms 452 KB Output is correct
10 Correct 346 ms 372 KB Output is correct
11 Correct 329 ms 368 KB Output is correct
12 Correct 352 ms 332 KB Output is correct
13 Correct 338 ms 376 KB Output is correct
14 Correct 320 ms 376 KB Output is correct
15 Correct 322 ms 332 KB Output is correct
16 Correct 313 ms 332 KB Output is correct
17 Correct 336 ms 332 KB Output is correct
18 Correct 319 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 204 KB Output is correct
2 Correct 75 ms 312 KB Output is correct
3 Correct 501 ms 380 KB Output is correct
4 Correct 507 ms 380 KB Output is correct
5 Correct 468 ms 384 KB Output is correct
6 Correct 359 ms 384 KB Output is correct
7 Correct 416 ms 384 KB Output is correct
8 Correct 422 ms 332 KB Output is correct
9 Correct 502 ms 452 KB Output is correct
10 Correct 346 ms 372 KB Output is correct
11 Correct 329 ms 368 KB Output is correct
12 Correct 352 ms 332 KB Output is correct
13 Correct 338 ms 376 KB Output is correct
14 Correct 320 ms 376 KB Output is correct
15 Correct 322 ms 332 KB Output is correct
16 Correct 313 ms 332 KB Output is correct
17 Correct 336 ms 332 KB Output is correct
18 Correct 319 ms 332 KB Output is correct
19 Correct 7919 ms 652 KB Output is correct
20 Execution timed out 9058 ms 716 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7388 ms 732 KB Output is correct
2 Execution timed out 9052 ms 1484 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 204 KB Output is correct
2 Correct 75 ms 312 KB Output is correct
3 Correct 501 ms 380 KB Output is correct
4 Correct 507 ms 380 KB Output is correct
5 Correct 468 ms 384 KB Output is correct
6 Correct 359 ms 384 KB Output is correct
7 Correct 416 ms 384 KB Output is correct
8 Correct 422 ms 332 KB Output is correct
9 Correct 502 ms 452 KB Output is correct
10 Correct 346 ms 372 KB Output is correct
11 Correct 329 ms 368 KB Output is correct
12 Correct 352 ms 332 KB Output is correct
13 Correct 338 ms 376 KB Output is correct
14 Correct 320 ms 376 KB Output is correct
15 Correct 322 ms 332 KB Output is correct
16 Correct 313 ms 332 KB Output is correct
17 Correct 336 ms 332 KB Output is correct
18 Correct 319 ms 332 KB Output is correct
19 Correct 7919 ms 652 KB Output is correct
20 Execution timed out 9058 ms 716 KB Time limit exceeded
21 Halted 0 ms 0 KB -