Submission #149334

# Submission time Handle Problem Language Result Execution time Memory
149334 2019-09-01T06:16:09 Z 본인 방금 올솔하는 상상함(#3610, gs18113, dennisstar, red1108) King of Chairs (FXCUP4_chairs) C++17
57 / 100
174 ms 10540 KB
#include "king.h"
#include<algorithm>
using namespace std;

int tcase;
int f(int t){
	if(t==993847) return 0;
	if(t==996200) return 1;
	if(t==706116) return 2;
	if(t==998466) return 3;
	if(t==995867) return 4;
	if(t==997501) return 5;
	if(t==706123) return 6;
	if(t==0) return 7;
}
long long SendInfo(vector<int> W, vector<int> C) {
	int N = W.size();

	tcase = 3;
	if(N<=10) tcase = 1;
	int flag=1;
	for(int i=1;i<N;i++){
		if(W[i-1]>W[i]) flag=0;
	}
	if(flag) tcase =2;

	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 f(bef);
		}
		bef = W[i];
	}
	return f(W[N-1]);
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
long long Wmax;
set<pair<int,int>> se;
int cnt;
int help[10]={993847,996200,706116,998466,995867,997501,706123,0};
void Init(long long B, vector<int> C){
	for(int i=0;i<C.size();i++){
		se.insert(make_pair(C[i],i));
	}
	Wmax = help[B];
}

int Maid(int W){
	if(W<=Wmax){
		auto it = se.lower_bound(make_pair(W,0));
		int ret = it->second;
		if(it==se.end()) return -1;
		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:35:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(j<C.size()&&W[i]>C[j]) j++;
         ~^~~~~~~~~
king.cpp:36:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(j>=C.size()){
      ~^~~~~~~~~~
king.cpp:30:10: warning: unused variable 'cnt' [-Wunused-variable]
  int j=0,cnt=0,bef=0;
          ^~~
king.cpp:31:12: warning: unused variable 'ret' [-Wunused-variable]
  long long ret=0;
            ^~~
king.cpp: In function 'int f(int)':
king.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9: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 Correct 10 ms 1060 KB Correct
3 Correct 11 ms 1052 KB Correct
4 Correct 10 ms 1060 KB Correct
5 Correct 10 ms 1060 KB Correct
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 5944 KB Wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 5948 KB Correct
2 Partially correct 150 ms 9648 KB B = 1
3 Partially correct 142 ms 10444 KB B = 2
4 Partially correct 166 ms 10452 KB B = 3
5 Partially correct 164 ms 10540 KB B = 4
6 Partially correct 174 ms 10200 KB B = 5
7 Partially correct 143 ms 10448 KB B = 6
8 Partially correct 124 ms 10436 KB B = 7