제출 #43960

#제출 시각아이디문제언어결과실행 시간메모리
43960IvanCKralj (COCI16_kralj)C++17
56 / 140
2081 ms82908 KiB
#include <bits/stdc++.h>
#define LSOne(S) (S & (-S))
using namespace std;
const int MAXN = 1e6 + 10;
int Dwarves[MAXN],A[MAXN],N,exibe;
set<int> Elves,Mesa;
int main(){
	scanf("%d",&N);
	for(int i = 1;i<=N;i++){
		scanf("%d",&A[i]);
		Mesa.insert(i);
		Mesa.insert(i+N);
	}
	for(int i = 1;i<=N;i++){
		scanf("%d",&Dwarves[i]);
	}
	for(int i = 1;i<=N;i++){
		int x;
		scanf("%d",&x);
		Elves.insert(x);
	}
	for(int vez = 1;vez<=N;vez++){
		int posicao = *Mesa.lower_bound(A[vez]);
		if(posicao > N) posicao -= N;
		Mesa.erase(posicao);
		Mesa.erase(posicao+N);
		int dwarf = Dwarves[posicao];
		if((*Elves.rbegin()) < dwarf){
			Elves.erase(Elves.begin());
		}
		else{
			exibe++;
			Elves.erase(Elves.lower_bound(dwarf));
		}
		//printf("Vez %d\n",vez);
	}
	printf("%d\n",exibe);
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

kralj.cpp: In function 'int main()':
kralj.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
  ~~~~~^~~~~~~~~
kralj.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&A[i]);
   ~~~~~^~~~~~~~~~~~
kralj.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&Dwarves[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~
kralj.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...