답안 #96457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96457 2019-02-09T14:21:51 Z KLPP DEL13 (info1cup18_del13) C++14
6 / 100
29 ms 1272 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;

int possible(int n,vector<int> v){
	vector<int> diff;
	for(int i=0;i<v.size()-1;i++){
		diff.push_back(v[i+1]-v[i]-1);
	}
	/*for(int i=0;i<diff.size();i++){
		cout<<diff[i]<<" ";
	}cout<<endl;*/
	int res=0;
	int sz=0;
	for(int i=0;i<diff.size();i++){
		if(diff[i]!=0){
			sz++;
			res+=diff[i];
			res%=2;
		}else{
			if(sz==1 || res!=0)return -1;
			sz=0;
			res=0;
		}
	}
	if(sz==1 || res!=0)return -1;
	return 0;
}
int main(){
	int T;
	cin>>T;
	while(T--){
		int n;
		cin>>n;
		int l;
		cin>>l;
		vector<int> seq(l+2);
		seq[0]=0;
		for(int i=1;i<=l;i++){
			cin>>seq[i];
		}seq[l+1]=n+1;
		int sol=possible(n,seq);
		cout<<sol<<endl;
		if(sol)cout<<endl;
	}
	return 0;
}

Compilation message

del13.cpp: In function 'int possible(int, std::vector<int>)':
del13.cpp:8:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<v.size()-1;i++){
              ~^~~~~~~~~~~
del13.cpp:16:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<diff.size();i++){
              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 252 KB Output isn't correct
2 Incorrect 3 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 252 KB Output isn't correct
2 Incorrect 3 ms 256 KB Output isn't correct
3 Incorrect 11 ms 376 KB Output isn't correct
4 Incorrect 11 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 7 ms 376 KB Output is partially correct
2 Partially correct 6 ms 376 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 252 KB Output isn't correct
2 Incorrect 3 ms 256 KB Output isn't correct
3 Incorrect 11 ms 376 KB Output isn't correct
4 Incorrect 11 ms 376 KB Output isn't correct
5 Partially correct 3 ms 376 KB Output is partially correct
6 Partially correct 3 ms 376 KB Output is partially correct
7 Partially correct 3 ms 376 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 252 KB Output isn't correct
2 Incorrect 3 ms 256 KB Output isn't correct
3 Incorrect 11 ms 376 KB Output isn't correct
4 Incorrect 11 ms 376 KB Output isn't correct
5 Partially correct 3 ms 376 KB Output is partially correct
6 Partially correct 3 ms 376 KB Output is partially correct
7 Partially correct 3 ms 376 KB Output is partially correct
8 Partially correct 15 ms 632 KB Output is partially correct
9 Partially correct 29 ms 1012 KB Output is partially correct
10 Partially correct 28 ms 1012 KB Output is partially correct
11 Partially correct 17 ms 1272 KB Output is partially correct