QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#354059#8221. 多方计算xyz123Compile Error//C++142.6kb2024-03-14 21:05:552024-03-14 21:05:56

Judging History

你现在查看的是最新测评结果

  • [2024-03-14 21:05:56]
  • 评测
  • [2024-03-14 21:05:55]
  • 提交

answer

#include<bits/stdc++.h>
#include "mpc.h"
using namespace std;
const int N=22000,M=2200;
long long a,b;
int precalc(int n, int m)
{
	a=n,b=m;
	long long tt=1,gg=0;
	while(tt<=m) tt*=2,++gg;
	return n+m+gg;
}
bool transmit(player &player, int round, int position)
{
	int tt=player.last_message;
	int g1=position-round;
	if(g1>=0)
	{
		player.memory[g1]+=tt;
		for(int i=g1;i<=M;i++)
		{
			if(player.memory[i]>1)
			{
				player.memory[i]-=2;
				player.memory[i+1]++;
			}
			else break;
		}
	}
	if(round>position+1)
	{
		return 0;
	}
	int gg=position+1-round;
	return player.memory[gg];
}

namespace grader{
    int score[10]={100,13,11,8,5,5,4,4,3,3};
    std::mt19937_64 rnd(time(0));
    struct bigint{
        int val[M];
        void clear(){
            memset(val,0,sizeof(val));
        }
        void gen(int len){
            for(int i=0;i<len;i++)val[i]=rnd()%2;
        }
        void read(int len){
            for(int i=0;i<len;i++)std::cin>>val[i];
        }
        void print(int len){
            for(int i=0;i<len;i++)printf("%d",val[i]);
            printf("\n");
        }
    }num[N],correct_result;
    bigint plus(bigint x, bigint y){
        int carry=0;
        bigint ans;ans.clear();
        for(int i=0;i<M;i++){
            ans.val[i]=(x.val[i]+y.val[i]+carry)%2;
            carry=(x.val[i]+y.val[i]+carry)/2;
        }
        return ans;
    }
    int n,m,ans;
    ::player player[N];
    void gen_data(int n,int m){
        for(int i=0;i<n;i++)num[i].read(m);
        correct_result.clear();
        for(int i=0;i<n;i++)correct_result=plus(correct_result,num[i]);
    }
    void grade(){
        std::cin>>n>>m;
        ans=precalc(n,m);
        gen_data(n,m);
        for(int i=0;i<n;i++){
            player[i].memory.fill(0);
            for(int j=0;j<M;j++)player[i].memory[j]=num[i].val[j];
        }
        for(int i=1;i<=ans;i++){
            for(int j=n;j>=0;j--){
                bool curr=transmit(player[j],i,j);
                if(j<n)player[j+1].last_message=curr;
            }
        }
        bool correct=1;
        correct_result.print(M);
        for(int i=0;i<M;i++)correct&=(player[n].memory[i]==correct_result.val[i]);
        for(int i=0;i<M;i++)printf("%d",player[n].memory[i]);puts("");
        if(!correct){
            printf("Your answer is not correct.");
        }
        else{
            int score_=0;
            for(int i=0;i<=9;i++)if(n+m+score[i]>=ans)score_++;
            printf("OK, you get %d%% points",score_*10);
        }
    }
}

int main(){
	std::ios::sync_with_stdio(0);std::cin.tie(0);
    grader::grade();
	return 0;
}

Details

/usr/bin/ld: /tmp/ccZJhf3d.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccJn4iEf.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status