답안 #277860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
277860 2020-08-21T07:47:58 Z Revo7 Bubble Sort 2 (JOI18_bubblesort2) C++14
38 / 100
9000 ms 3424 KB
#include "bubblesort2.h"
#include<bits/stdc++.h>
#define pb push_back

using namespace std;

vector<int> countScans(vector<int> a,vector<int> pos,vector<int> v){
    set<pair<int,int>>s;
    for(int i=0;i<a.size();i++){
        s.insert({a[i],i});
    }
    vector<int>ans;
    for(int i=0;i<pos.size();i++){
        int mx=0;
        s.erase({a[pos[i]],pos[i]});
        a[pos[i]]=v[i];
        s.insert({a[pos[i]],pos[i]});
        int cur=0;
        for(auto x:s){
            mx=max(mx,x.second-cur);
            cur++;
        }
        ans.pb(mx);
        //cout<<ans.back()<<endl;
    }
	return ans;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0;i<a.size();i++){
      |                 ~^~~~~~~~~
bubblesort2.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<pos.size();i++){
      |                 ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 48 ms 512 KB Output is correct
4 Correct 50 ms 512 KB Output is correct
5 Correct 57 ms 512 KB Output is correct
6 Correct 40 ms 512 KB Output is correct
7 Correct 39 ms 512 KB Output is correct
8 Correct 42 ms 512 KB Output is correct
9 Correct 47 ms 512 KB Output is correct
10 Correct 38 ms 512 KB Output is correct
11 Correct 48 ms 512 KB Output is correct
12 Correct 38 ms 512 KB Output is correct
13 Correct 39 ms 544 KB Output is correct
14 Correct 40 ms 512 KB Output is correct
15 Correct 38 ms 512 KB Output is correct
16 Correct 40 ms 512 KB Output is correct
17 Correct 39 ms 632 KB Output is correct
18 Correct 39 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 48 ms 512 KB Output is correct
4 Correct 50 ms 512 KB Output is correct
5 Correct 57 ms 512 KB Output is correct
6 Correct 40 ms 512 KB Output is correct
7 Correct 39 ms 512 KB Output is correct
8 Correct 42 ms 512 KB Output is correct
9 Correct 47 ms 512 KB Output is correct
10 Correct 38 ms 512 KB Output is correct
11 Correct 48 ms 512 KB Output is correct
12 Correct 38 ms 512 KB Output is correct
13 Correct 39 ms 544 KB Output is correct
14 Correct 40 ms 512 KB Output is correct
15 Correct 38 ms 512 KB Output is correct
16 Correct 40 ms 512 KB Output is correct
17 Correct 39 ms 632 KB Output is correct
18 Correct 39 ms 512 KB Output is correct
19 Correct 711 ms 1168 KB Output is correct
20 Correct 965 ms 1184 KB Output is correct
21 Correct 670 ms 1272 KB Output is correct
22 Correct 833 ms 1300 KB Output is correct
23 Correct 647 ms 1152 KB Output is correct
24 Correct 685 ms 1144 KB Output is correct
25 Correct 722 ms 1144 KB Output is correct
26 Correct 669 ms 1144 KB Output is correct
27 Correct 714 ms 1144 KB Output is correct
28 Correct 726 ms 1268 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1209 ms 2008 KB Output is correct
2 Execution timed out 9026 ms 3424 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 48 ms 512 KB Output is correct
4 Correct 50 ms 512 KB Output is correct
5 Correct 57 ms 512 KB Output is correct
6 Correct 40 ms 512 KB Output is correct
7 Correct 39 ms 512 KB Output is correct
8 Correct 42 ms 512 KB Output is correct
9 Correct 47 ms 512 KB Output is correct
10 Correct 38 ms 512 KB Output is correct
11 Correct 48 ms 512 KB Output is correct
12 Correct 38 ms 512 KB Output is correct
13 Correct 39 ms 544 KB Output is correct
14 Correct 40 ms 512 KB Output is correct
15 Correct 38 ms 512 KB Output is correct
16 Correct 40 ms 512 KB Output is correct
17 Correct 39 ms 632 KB Output is correct
18 Correct 39 ms 512 KB Output is correct
19 Correct 711 ms 1168 KB Output is correct
20 Correct 965 ms 1184 KB Output is correct
21 Correct 670 ms 1272 KB Output is correct
22 Correct 833 ms 1300 KB Output is correct
23 Correct 647 ms 1152 KB Output is correct
24 Correct 685 ms 1144 KB Output is correct
25 Correct 722 ms 1144 KB Output is correct
26 Correct 669 ms 1144 KB Output is correct
27 Correct 714 ms 1144 KB Output is correct
28 Correct 726 ms 1268 KB Output is correct
29 Correct 1209 ms 2008 KB Output is correct
30 Execution timed out 9026 ms 3424 KB Time limit exceeded
31 Halted 0 ms 0 KB -