Submission #149202

# Submission time Handle Problem Language Result Execution time Memory
149202 2019-09-01T05:57:09 Z 본인 방금 올솔하는 상상함(#3610, gs18113, dennisstar, red1108) King of Chairs (FXCUP4_chairs) C++17
0 / 100
70 ms 5952 KB
#include "king.h"
#include<algorithm>
using namespace std;
long long SendInfo(vector<int> W, vector<int> C) {
	int N = W.size();
	sort(W.begin(), W.end());
	sort(C.begin(), C.end());
	int j=0,cnt=0,bef=0;
	long long ret=0;


	for(int i=0;i<N;i++,j++){
		while(j<C.size()&&W[i]>C[j]) j++;
		if(j>=C.size()){
			return bef;
		}
	}
	return W[N-1];
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
long long Wmax;
set<pair<int,int>> se;
int cnt;
void Init(long long B, vector<int> C){
	for(int i=0;i<C.size();i++){
		se.insert(make_pair(C[i],i));
	}
	Wmax = B;
}

int Maid(int W){
	if(W<=Wmax){
		auto it = se.lower_bound(make_pair(W,0));
		int ret = it->second;
		if((it->first)<W) return -1;
		se.erase(it);
		cnt++;
		return ret;
	}
	return -1;
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:13:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(j<C.size()&&W[i]>C[j]) j++;
         ~^~~~~~~~~
king.cpp:14:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(j>=C.size()){
      ~^~~~~~~~~~
king.cpp:8:10: warning: unused variable 'cnt' [-Wunused-variable]
  int j=0,cnt=0,bef=0;
          ^~~
king.cpp:9:12: warning: unused variable 'ret' [-Wunused-variable]
  long long ret=0;
            ^~~

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:8:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<C.size();i++){
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1060 KB Correct
2 Incorrect 11 ms 1060 KB Wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 5952 KB Wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 5948 KB Wrong
2 Halted 0 ms 0 KB -