CODE FESTIVAL 2016 Grand Final

Submission #4184220

Source codeソースコード

#include<bits/stdc++.h>
using namespace std;
     
#define MAX 100002
#define MOD 1000000007
int n;
vector<pair<int,int> > v;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		v.push_back(make_pair(a,0));
	}
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		v.push_back(make_pair(a,1));
	}
	sort(v.begin(),v.end());
	int cnt=0;
	int p=-1;
	long long int way=1;
	for(int i=0;i<v.size();i++){
		if(cnt==0){
			p=v[i].second;
			cnt=1;
			continue;
		}
		if(p!=v[i].second){
			way*=cnt;
			way%=MOD;
			cnt--;
			continue;
		}
		cnt++;
	}
	printf("%lld\n",way);
	return 0;
}

Submission

Task問題 A - 1D Matching
User nameユーザ名 Greenland
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 500
Source lengthソースコード長 638 Byte
File nameファイル名
Exec time実行時間 42 ms
Memory usageメモリ使用量 2420 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:12:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a);
^
./Main.cpp:17:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - example0.txt,example1.txt
All 500 / 500 000.txt,001.txt,002.txt,003.txt,004.txt,005.txt,006.txt,007.txt,008.txt,009.txt,010.txt,011.txt,example0.txt,example1.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
000.txt AC 26 ms 1400 KB
001.txt AC 10 ms 892 KB
002.txt AC 13 ms 892 KB
003.txt AC 15 ms 1400 KB
004.txt AC 38 ms 2420 KB
005.txt AC 42 ms 2420 KB
006.txt AC 42 ms 2420 KB
007.txt AC 42 ms 2420 KB
008.txt AC 42 ms 2420 KB
009.txt AC 42 ms 2420 KB
010.txt AC 42 ms 2420 KB
011.txt AC 42 ms 2420 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB