QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239334#7688. Alea Iacta Estucup-team191#Compile Error//C++142.2kb2023-11-04 20:09:442023-11-04 20:09:44

Judging History

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

  • [2023-11-04 20:09:44]
  • 评测
  • [2023-11-04 20:09:44]
  • 提交

answer

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cassert>
#define pb push_back
#define x first
#define y second

#define int long long

using namespace std;
using vi=vector<int>;

typedef long long ll;

const int N = 3e6 + 500;

int tmp[N], odg[N], cnt[N], svi[N], out = 0, in = 0;

vi mul(vi a,vi b)
{
	vi c;
	for (auto x: a) for (auto y: b) c.pb(x+y);
	return c;
}

vi getvec(int cn,int x)
{
	vi v;
	for (int i=0;i<cn;++i) v.pb(i*x);
	return v;
}

pair<vi,vi> decomp(int n,int a)
{
	assert(n%a==0);
	return {getvec(a,1),getvec(n/a,a)};
}

void solve(){
	int n, m; cin >> n >> m;
	if(n < m) swap(n, m);
	ll fak = (ll)n * m;
	ll poc = sqrt(fak) + 1;
	vi a1,a2;
	bool nad=0;
	if (n==m)
	{
		ll u=sqrt(n)+1;
		while (u*u>n) --u;
		if (u*u==n)
		{
			auto r1=decomp(n,u);
			a1=mul(r1.x,r1.x);
			a2=mul(r1.y,r1.y);
			nad=1;
		}
	}
	while (poc * poc > fak) poc--;
	for(ll i = poc;i >= 1;i--) {
		if (nad) break;
		if(fak % i == 0 && i != m && i + fak / i < (ll)n + 2 * m) {
			ll u=i,v=fak/i;
			ll u1=__gcd(u,n),u2=u/u1;
			ll v1=n/u1,v2=m/u2;
			assert(u1*v1==n);
			assert(u2*v2==m);
			assert(u1*u2==u);
			assert(v1*v2==v);
			auto r1=decomp(n,u1),r2=decomp(m,u2);
			a1=mul(r1.x,r2.x);
			a2=mul(r1.y,r2.y);
			nad=1;
			break;
		}
		if (fak%i==0 && i==m && i!=n && __gcd(n,m)>1)
		{
			ll u=__gcd(n,m);
			auto r1=decomp(n,u),r2=decomp(m,m/u);
			a1=mul(r1.x,r2.x);
			a2=mul(r1.y,r2.y);
			nad=1;
			break;
		}
		
	}
	if (!nad)
	{
		for (int i=0;i<n;++i) a1.pb(i);
		for (int i=0;i<m;++i) a2.pb(i),a2.pb(i);
		nad=1;
	}
	int f1=a1.size(),f2=a2.size();
	//cout << n << " " << m << "\n";
	
	cout<<f1<<"\n";
	for (auto x: a1) cout<<x+1<<' ';
	cout<<"\n";
	cout<<f2<<"\n";
	for (auto x: a2) cout<<x+1<<' ';
	cout<<"\n";
	
	out += f1 + f2; in += n;
	//cout << n << " " << m << " 		" << f1 << " " << f2 << endl;
	//if(f1 + f2 >= n + m) cout << "kurcina\n";
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int T; cin >> T;
	//cout << T << endl;
	for(;T--;) {
		//printf("T = %d\n", T);
		solve();
	}
	//cout << in << endl;
	//cout << out << endl;
}

Details

answer.code:13:10: error: ‘vector’ does not name a type
   13 | using vi=vector<int>;
      |          ^~~~~~
answer.code:21:1: error: ‘vi’ does not name a type; did you mean ‘void’?
   21 | vi mul(vi a,vi b)
      | ^~
      | void
answer.code:28:1: error: ‘vi’ does not name a type; did you mean ‘void’?
   28 | vi getvec(int cn,int x)
      | ^~
      | void
answer.code:35:6: error: ‘vi’ was not declared in this scope; did you mean ‘svi’?
   35 | pair<vi,vi> decomp(int n,int a)
      |      ^~
      |      svi
answer.code:35:9: error: ‘vi’ was not declared in this scope; did you mean ‘svi’?
   35 | pair<vi,vi> decomp(int n,int a)
      |         ^~
      |         svi
answer.code:35:11: error: template argument 1 is invalid
   35 | pair<vi,vi> decomp(int n,int a)
      |           ^
answer.code:35:11: error: template argument 2 is invalid
answer.code: In function ‘int decomp(long long int, long long int)’:
answer.code:38:17: error: ‘getvec’ was not declared in this scope; did you mean ‘getwc’?
   38 |         return {getvec(a,1),getvec(n/a,a)};
      |                 ^~~~~~
      |                 getwc
answer.code:38:42: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘int’ in return
   38 |         return {getvec(a,1),getvec(n/a,a)};
      |                                          ^
answer.code: In function ‘void solve()’:
answer.code:46:9: error: ‘vi’ was not declared in this scope; did you mean ‘svi’?
   46 |         vi a1,a2;
      |         ^~
      |         svi
answer.code:55:25: error: ‘a1’ was not declared in this scope; did you mean ‘r1’?
   55 |                         a1=mul(r1.x,r1.x);
      |                         ^~
      |                         r1
answer.code:7:11: error: request for member ‘first’ in ‘r1’, which is of non-class type ‘int’
    7 | #define x first
      |           ^~~~~
answer.code:55:35: note: in expansion of macro ‘x’
   55 |                         a1=mul(r1.x,r1.x);
      |                                   ^
answer.code:7:11: error: request for member ‘first’ in ‘r1’, which is of non-class type ‘int’
    7 | #define x first
      |           ^~~~~
answer.code:55:40: note: in expansion of macro ‘x’
   55 |                         a1=mul(r1.x,r1.x);
      |                                        ^
answer.code:55:28: error: ‘mul’ was not declared in this scope; did you mean ‘fmul’?
   55 |                         a1=mul(r1.x,r1.x);
      |                            ^~~
      |                            fmul
answer.code:56:25: error: ‘a2’ was not declared in this scope
   56 |                         a2=mul(r1.y,r1.y);
      |                         ^~
answer.code:8:11: error: request for member ‘second’ in ‘r1’, which is of non-class type ‘int’
    8 | #define y second
      |           ^~~~~~
answer.code:56:35: note: in expansion of macro ‘y’
   56 |                         a2=mul(r1.y,r1.y);
      |                                   ^
answer.code:8:11: error: request for member ‘second’ in ‘r1’, which is of non-class type ‘int’
    8 | #define y second
      |           ^~~~~~
answer.code:56:40: note: in expansion of macro ‘y’
   56 |                         a2=mul(r1.y,r1.y);
      |                                        ^
answer.code:72:25: error: ‘a1’ was not declared in this scope; did you mean ‘r1’?
   72 |                         a1=mul(r1.x,r2.x);
      |                         ^~
      |                         r1
answer.code:7:11: error: request for member ‘first’ in ‘r1’, which is of non-class type ‘int’
    7 | #define x first
      |           ^~~~~
answer.code:72:35: note: in expansion of macro ‘x’
   72 |                         a1=mul(r1.x,r2.x);
      |                                   ^
answer.code:7:11: error: request for member ‘first’ in ‘r2’, which is of non-class type ‘int’
    7 | #define x first
      |           ^~~~~
answer.code:72:40: note: in expansion of macro ‘x’
   72 |                         a1=mul(r1.x,r2.x);
      |                                        ^
answer.code:72:28: error: ‘mul’ was not declared in this scope; did you mean ‘fmul’?
   72 |                         a1=mul(r1.x,r2.x);
      |                            ^~~
      |                            fmul
answer.code:73:25: error: ‘a2’ was not declared in this scope; did you mean ‘r2’?
   73 |                         a2=mul(r1.y,r2.y);
      |                         ^~
      |                         r2
answer.code:8:11: error: request for member ‘second’ in ‘r1’, which is of non-class type ‘int’
    8 | #define y second
      |           ^~~~~~
answer.code:73:35: note: in expansion of macro ‘y’
   73 |                         a2=mul(r1.y,r2.y);
      |                                   ^
answer.code:8:11: error: request for member ‘second’ in ‘r2’, which is of non-class type ‘int’
    8 | #define y second
      |           ^~~~~~
answer.code:73:40: note: in expansion of macro ‘y’
   73 |                         a2=mul(r1.y,r2.y);
      |         ...