QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#104388#370. CityDaiRuiChen007Compile Error//C++141.0kb2023-05-10 16:34:072023-05-10 16:34:08

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-10 16:34:08]
  • 评测
  • [2023-05-10 16:34:07]
  • 提交

Encoder

#include<bits/stdc++.h>
#define double long double
#include "Encoder.h"
using namespace std;
const int MAXN=2.5e5+1,C=512;
const double Q=1.023;
vector <int> G[MAXN];
int dfn[MAXN],siz[MAXN],dcnt=0,pw[C];
inline void dfs(int p,int fa) {
	dfn[p]=++dcnt,siz[p]=1;
	for(int v:G[p]) if(v!=fa) dfs(v,p),siz[p]+=siz[v];
	int k=lower_bound(pw,pw+C,siz[p])-pw;
	siz[p]=pw[k],dcnt=dfn[p]+siz[p]-1;
	Code(p,k+1ll*C*dfn[p]);
}
void Encode(int N,int A[],int B[]) {
	for(int i=0;i<N-1;++i) {
		G[A[i]].push_back(B[i]);
		G[B[i]].push_back(A[i]);
	}
	pw[0]=1;
	for(int i=1;i<C;++i) pw[i]=max(pw[i-1]+1,(int)(pw[i-1]*Q));
	dfs(0,0);
}

Device

#include<bits/stdc++.h>
#define double long double
#define ll long long
#include "Device.h"
using namespace std;
const int MAXN=2.5e5+1,C=512;
const double Q=1.023;
int pw[C];
void InitDevice() {
	for(int i=1;i<MAXC;++i) pw[i]=max(pw[i-1]+1,(int)(pw[i-1]*Q));
}
int Answer(ll S,ll T) {
	int d1=S/C,s1=pw[S%C];
	int d2=T/C,s2=pw[T%C];
	if(d1<=d2&&d2<d1+s1) return 1;
	if(d2<=d1&&d1<d2+s2) return 1;
	return 2;
}

詳細信息

Device.code: In function ‘void InitDevice()’:
Device.code:10:23: error: ‘MAXC’ was not declared in this scope; did you mean ‘MAXN’?
   10 |         for(int i=1;i<MAXC;++i) pw[i]=max(pw[i-1]+1,(int)(pw[i-1]*Q));
      |                       ^~~~
      |                       MAXN
grader.cpp: In function ‘int main(int, char**)’:
grader.cpp:62:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   62 |                         printf("%d ", given_code[i]);
      |                                 ~^    ~~~~~~~~~~~~~
      |                                  |                |
      |                                  int              long long int
      |                                 %lld
grader.cpp:73:33: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   73 |                         scanf("%d", &given_code[i]);
      |                                ~^   ~~~~~~~~~~~~~~
      |                                 |   |
      |                                 |   long long int*
      |                                 int*
      |                                %lld
grader.cpp:44:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |                 scanf("%d%d", &N, &Q);
      |                 ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:46:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |                         scanf("%d%d", &(A[i]), &(B[i]));
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
grader.cpp:49:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   49 |                         scanf("%d%d", &(X[i]), &(Y[i]));
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
grader.cpp:71:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   71 |                 scanf("%d%d", &N, &Q);
      |                 ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:73:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   73 |                         scanf("%d", &given_code[i]);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
grader.cpp:77:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   77 |                         scanf("%d%d", &X, &Y);
      |                         ~~~~~^~~~~~~~~~~~~~~~