Submission #57164

# Submission time Handle Problem Language Result Execution time Memory
57164 2018-07-14T07:45:30 Z 정원준(#1655) JOIRIS (JOI16_joiris) C++11
30 / 100
4 ms 672 KB
#include <bits/stdc++.h>
#define L long long

using namespace std;

L n,k;
L a[55];

vector<L>ans1,ans2;

int main()
{
	scanf("%lld %lld",&n,&k);
	L i,j,k;
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(i=2;i<=n;i++)
	{
		while(a[i]<a[i-1])
		{
			ans1.push_back(1);
			ans2.push_back(i);
			a[i]+=2;
		}
	}
	for(i=2;i<=n;i++)
	{
		a[i]-=a[1];
	}
	a[1]=0;
	for(i=3;i<=n;i++)
	{
		while(a[i]>a[i-1])
		{
			for(j=i-2;j>=1;j-=2)
			{
				ans1.push_back(2);
				ans2.push_back(j);
				a[j]++;
				a[j+1]++;
				if(j==1)
				{
					for(k=1;k<=n;k++)
					{
						a[k]--;
					}
				}
			}
		/*puts("");
		for(k=1;k<=n;k++)
		{
			printf("%lld ",a[k]);
		}
		puts("");*/
		}
	}
	for(i=1;i<=(a[2]+1)/2;i++)
	{
		ans1.push_back(1);
		ans2.push_back(1);
	}
	if(a[2]%2)
	{
		if(n%2)
		{
			for(i=2;i<=n;i+=2)
			{
				ans1.push_back(2);
				ans2.push_back(i);
			}
		}
		else
		{
			puts("-1");
			return 0;
		}
	}
	printf("%lld\n",ans1.size());
	for(i=0;i<ans1.size();i++)
	{
		printf("%lld %lld\n",ans1[i],ans2[i]);
	}
}

Compilation message

joiris.cpp: In function 'int main()':
joiris.cpp:80:29: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'std::vector<long long int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%lld\n",ans1.size());
                  ~~~~~~~~~~~^
joiris.cpp:81:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<ans1.size();i++)
          ~^~~~~~~~~~~~
joiris.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld",&n,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~
joiris.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 3 ms 540 KB Output is correct
7 Correct 4 ms 540 KB Output is correct
8 Correct 2 ms 540 KB Output is correct
9 Correct 2 ms 548 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 3 ms 612 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 2 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 612 KB Output is correct
2 Correct 3 ms 612 KB Output is correct
3 Correct 2 ms 612 KB Output is correct
4 Correct 3 ms 612 KB Output is correct
5 Correct 3 ms 620 KB Output is correct
6 Correct 3 ms 636 KB Output is correct
7 Correct 2 ms 636 KB Output is correct
8 Correct 3 ms 636 KB Output is correct
9 Correct 2 ms 652 KB Output is correct
10 Correct 3 ms 652 KB Output is correct
11 Correct 2 ms 672 KB Output is correct
12 Correct 2 ms 672 KB Output is correct
13 Correct 2 ms 672 KB Output is correct
14 Correct 2 ms 672 KB Output is correct
15 Correct 3 ms 672 KB Output is correct
16 Correct 2 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 3 ms 540 KB Output is correct
7 Correct 4 ms 540 KB Output is correct
8 Correct 2 ms 540 KB Output is correct
9 Correct 2 ms 548 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 3 ms 612 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 2 ms 612 KB Output is correct
17 Incorrect 2 ms 672 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 3 ms 540 KB Output is correct
7 Correct 4 ms 540 KB Output is correct
8 Correct 2 ms 540 KB Output is correct
9 Correct 2 ms 548 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 3 ms 612 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 2 ms 612 KB Output is correct
17 Correct 3 ms 612 KB Output is correct
18 Correct 3 ms 612 KB Output is correct
19 Correct 2 ms 612 KB Output is correct
20 Correct 3 ms 612 KB Output is correct
21 Correct 3 ms 620 KB Output is correct
22 Correct 3 ms 636 KB Output is correct
23 Correct 2 ms 636 KB Output is correct
24 Correct 3 ms 636 KB Output is correct
25 Correct 2 ms 652 KB Output is correct
26 Correct 3 ms 652 KB Output is correct
27 Correct 2 ms 672 KB Output is correct
28 Correct 2 ms 672 KB Output is correct
29 Correct 2 ms 672 KB Output is correct
30 Correct 2 ms 672 KB Output is correct
31 Correct 3 ms 672 KB Output is correct
32 Correct 2 ms 672 KB Output is correct
33 Incorrect 2 ms 672 KB Output isn't correct
34 Halted 0 ms 0 KB -