Submission #143621

# Submission time Handle Problem Language Result Execution time Memory
143621 2019-08-14T18:21:56 Z shashwatchandra Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
9000 ms 2520 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i = 0;i < n;i++)

vector<int> countScans(vector<int> a,vector<int> x,vector<int> v){
	vector<int> answer;
	REP(i,x.size()){
		a[x[i]] = v[i];
		int ans = 0;
		int ind = 0;
		REP(i,a.size()){
			if(a[ind] >= a[i])ind = i;
		}
		REP(i,ind){
			if(a[i] > a[ind])ans++;
		}
		answer.push_back(ans);
	}
	return answer;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:6:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,n) for(int i = 0;i < n;i++)
bubblesort2.cpp:10:6:
  REP(i,x.size()){
      ~~~~~~~~~~                   
bubblesort2.cpp:10:2: note: in expansion of macro 'REP'
  REP(i,x.size()){
  ^~~
bubblesort2.cpp:6:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,n) for(int i = 0;i < n;i++)
bubblesort2.cpp:14:7:
   REP(i,a.size()){
       ~~~~~~~~~~                  
bubblesort2.cpp:14:3: note: in expansion of macro 'REP'
   REP(i,a.size()){
   ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 258 ms 728 KB Output is correct
2 Correct 4227 ms 1604 KB Output is correct
3 Execution timed out 9018 ms 2520 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -