제출 #820201

#제출 시각아이디문제언어결과실행 시간메모리
820201alvingogo레지스터 (IOI21_registers)C++17
58 / 100
1 ms340 KiB
#include "registers.h"
#include <bits/stdc++.h>
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;

const int m=100,b=2000;
void construct_instructions(int s, int n, int k, int q) {
	if(s==0){
		vector<bool> le(b);
		int aw[8]={1,2,4,8,16,32,64,128};
		int p;
		for(int i=0;i<8;i++){
			if(n>aw[i]){
				continue;
			}
			p=i;
			break;
		}
		for(;n<aw[p];n++){
			for(int j=0;j<k;j++){
				le[n*k+j]=1;
			}
		}
		append_store(99,le);
		append_or(0,0,99);
		int w=2*k;
		while(p--){
			vector<bool> v(b),zero(b),one(b);
			for(int j=0;j<n*k;j+=w){
				for(int i=0;i<k;i++){
					v[j+i]=1;
				}
				one[j]=1;
			}
			append_store(98,v);
			append_store(97,one);
			append_right(1,0,w/2);
			append_and(0,0,98);
			append_and(1,1,98);
			append_xor(2,0,1);
			append_xor(1,1,98);
			int f=4;
			append_add(f,0,1);
			append_right(f,f,k);

			append_and(f,f,97);
			append_add(f,f,98);
			append_xor(f,f,98);
			append_and(f,f,2);
			append_xor(0,0,f);
			w<<=1;
		}
	}
}

컴파일 시 표준 에러 (stderr) 메시지

registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:21:14: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |   for(;n<aw[p];n++){
      |          ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...