Submission #420675

# Submission time Handle Problem Language Result Execution time Memory
420675 2021-06-08T13:16:46 Z Pyqe MalnaRISC (COI21_malnarisc) C++14
0 / 100
1 ms 224 KB
#include <bits/stdc++.h>

using namespace std;

long long n,nn;

void ad(long long x,long long w)
{
	if(x+(1ll<<w)<n)
	{
		printf(" R%lld R%lld",x+1,x+(1ll<<w)+1);
	}
}

int main()
{
	long long i,j,r,c=0;
	
	scanf("%lld",&n);
	for(nn=1;nn<n;nn*=2,c++);
	printf("%lld\n",c*(c+1)/2);
	for(i=1;1ll<<i<=nn;i++)
	{
		printf("CMPSWP");
		for(j=0;j<nn;j++)
		{
			if(!(j>>i-1&1))
			{
				ad(j,i-1);
			}
		}
		printf("\n");
		for(j=i-2;j+1;j--)
		{
			printf("CMPSWP");
			for(r=0;r<nn;r++)
			{
				if(!((r^r+(1ll<<j))>>i&1)&&(r>>j&1))
				{
					ad(r,j);
				}
			}
			printf("\n");
		}
	}
}

Compilation message

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:27:13: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   27 |    if(!(j>>i-1&1))
      |            ~^~
malnarisc.cpp:38:14: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   38 |     if(!((r^r+(1ll<<j))>>i&1)&&(r>>j&1))
      |             ~^~~~~~~~~
malnarisc.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 224 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Token "R3" doesn't correspond to pattern "CMPSWP"