답안 #359702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
359702 2021-01-27T06:49:15 Z ogibogi2004 DEL13 (info1cup18_del13) C++14
6 / 100
24 ms 8428 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+6;
bool dp[MAXN][3];
vector<int>last[MAXN][3];
void solve()
{
	int n,q;
	cin>>n>>q;
	vector<int>v;
	v.push_back(0);
	for(int i=0;i<q;i++)
	{
		int p;
		cin>>p;
		v.push_back(p);
	}
	v.push_back(n+1);
	for(int i=0;i<=v.size();i++)
	{
		for(int j=0;j<3;j++)
		{
			dp[i][j]=0;
			last[i][j].clear();
		}
	}
	dp[0][0]=1;
	for(int i=1;i<v.size();i++)
	{
		int t=v[i]-v[i-1]-1;
		vector<int>moves;
		int mid=(v[i]+v[i-1])/2;
		while(t>2)
		{
			moves.push_back(mid);
			t-=2;
		}
		for(int j=0;j<=t;j++)
		{
			if(dp[i-1][j])
			{
				vector<int>l=moves;
				for(int k=0;k<j;k++)
				{
					l.push_back(v[i-1]);
				}
				dp[i][t-j]=1;
				last[i][t-j]=l;
			}
		}
	}
	if(dp[v.size()-1][0])
	{
		cout<<"0\n";
	}
	else
	{
		cout<<"-1\n";
	}
}	
int main()
{
	int t;
	cin>>t;
	while(t--)solve();
return 0;
}

Compilation message

del13.cpp: In function 'void solve()':
del13.cpp:19:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=0;i<=v.size();i++)
      |              ~^~~~~~~~~~
del13.cpp:28:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int i=1;i<v.size();i++)
      |              ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 7404 KB Output isn't correct
2 Incorrect 7 ms 7404 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 7404 KB Output isn't correct
2 Incorrect 7 ms 7404 KB Output isn't correct
3 Incorrect 17 ms 7404 KB Output isn't correct
4 Incorrect 17 ms 7404 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 7660 KB Output is partially correct
2 Correct 9 ms 8076 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 7404 KB Output isn't correct
2 Incorrect 7 ms 7404 KB Output isn't correct
3 Incorrect 17 ms 7404 KB Output isn't correct
4 Incorrect 17 ms 7404 KB Output isn't correct
5 Incorrect 6 ms 7424 KB Output isn't correct
6 Incorrect 6 ms 7404 KB Output isn't correct
7 Incorrect 6 ms 7404 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 7404 KB Output isn't correct
2 Incorrect 7 ms 7404 KB Output isn't correct
3 Incorrect 17 ms 7404 KB Output isn't correct
4 Incorrect 17 ms 7404 KB Output isn't correct
5 Incorrect 6 ms 7424 KB Output isn't correct
6 Incorrect 6 ms 7404 KB Output isn't correct
7 Incorrect 6 ms 7404 KB Output isn't correct
8 Incorrect 19 ms 8080 KB Output isn't correct
9 Incorrect 23 ms 8112 KB Output isn't correct
10 Incorrect 24 ms 8152 KB Output isn't correct
11 Incorrect 21 ms 8428 KB Output isn't correct