Submission #342327

# Submission time Handle Problem Language Result Execution time Memory
342327 2021-01-01T22:22:09 Z ogibogi2004 cmp (balkan11_cmp) C++14
55 / 100
2826 ms 96236 KB
#include "cmp.h"
#include<bits/stdc++.h>
using namespace std;
void remember(int n) {
  //edit this
    string s="";
    for(int i=0;i<6;i++)
    {
		s+=char('0'+n%4);
		n/=4;
	}
	reverse(s.begin(),s.end());
	int t=0;
	for(int i=0;i<s.size();i++)
	{
		t=t*4+s[i]-'0'+1;
		bit_set(t);
	}
}

int compare(int b) {
  //edit this
	string s="";
    for(int i=0;i<6;i++)
    {
		s+=char('0'+b%4);
		b/=4;
	}
	reverse(s.begin(),s.end());
	int t=0;
	for(int i=0;i<s.size();i++)
	{
		t=t*4+s[i]-'0'+1;
		if(!bit_get(t))
		{
			for(int j=t-((t-1)%4+1)+1;j<t;j++)
			{
				if(bit_get(j))return 1;
			}
			return -1;
		}
	}
	return 0;
    return bit_get(13);
}

Compilation message

cmp.cpp: In function 'void remember(int)':
cmp.cpp:14:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i=0;i<s.size();i++)
      |              ~^~~~~~~~~
cmp.cpp: In function 'int compare(int)':
cmp.cpp:31:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i=0;i<s.size();i++)
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 2826 ms 96236 KB Output is partially correct - maxAccess = 15, score = 55