QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239462#7688. Alea Iacta Estucup-team2303#Compile Error//C++173.4kb2023-11-04 20:48:282023-11-04 20:48:28

Judging History

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

  • [2023-11-04 20:48:28]
  • 评测
  • [2023-11-04 20:48:28]
  • 提交

answer

/*
60 + 0 + 100 + 64 = 224.
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define L(i, j, k) for (int i = (j); i <= (k); i++)
#define R(i, j, k) for (int i = (j); i >= (k); i--)
#define pb push_back
#define pii pair<int, int>
// inline int read()
// {
//     int sum = 0, nega = 1;
//     char ch = getchar();
//     while (ch > '9'||ch < '0')
//     {
//         if (ch == '-') nega = -1;
//         ch = getchar();
//     }
//     while (ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
//     return sum * nega;
// }
const int N = 7e7 + 9, mod = 998244353;
inline void add(int &x, int y) {x = (x + y) % mod;}
inline void del(int &x, int y) {x = (x - y + mod) % mod;}
int T, x, y, siz, a, b, ca, cb;
int G[2][N], F[109], tmp[N], id = 0;
inline void Write(int X)
{
    cout << X << ' ';
    // if(X > 9) Write(X / 10);;
    // putchar(X % 10 + '0');
}
inline void dfs(int fx, int fy, int fa, int fb, int nw)
{
    if(nw == siz + 1) return ;
    int fac = F[nw];
    if(x % fac != 0 && y % fac != 0) {dfs(fx, fy, fa, fb, nw + 1); return ;}
    if(x % fac != 0) swap(x, y), swap(fx, fy);
    if(a % fac != 0) id ^= 1, swap(fa, fb), swap(a, b), swap(ca, cb);
    x /= fac, a /= fac;
    int val = 1, cn = 0;
    L(i, 1, fac)
    {
        L(j, 1, ca) tmp[++cn] = G[id][j] + val - 1;
        val += fx;
    }
    L(i, 1, cn) G[id][i] = tmp[i]; ca = cn;
    fx *= fac, fa *= fac;
//  puts("----------------------");
//  cout << ca << " " << cb << endl;
//  L(i, 1, ca) cout << G[id][i] << " "; cout << endl;
//  L(i, 1, cb) cout << G[id ^ 1][i] << " "; cout << endl;
//  puts("------------------------");
    dfs(fx, fy, fa, fb, nw); return ;
}
inline void work()
{
    ca = cb = 1;
    G[0][1] = 1, G[1][1] = 1; id = 0;
    dfs(1, 1, 1, 1, 1);
    Write(ca);
    L(i, 1, ca)
    {
        Write(G[id][i]);
    }
    cout << '\n';
    Write(cb);
    L(i, 1, cb)
    {
        Write(G[id ^ 1][i]);
    }
    cout << '\n'; return ;
}
inline void get(int x, int y, int a, int b)
{
    if(x % a != 0 && x % b != 0) swap(x, y);
    if(x % a != 0) swap(a, b);
    Write(a);
    L(i, 1, a)
    {
        Write(i);
    }
    cout << '\n';
    Write(b);
    int nw = 1;
    L(i, 1, b / y)
    {
        L(j, 1, y)
        {
            Write(nw + j - 1);;
        }
        nw += a;
    }
    cout << '\n'; return ;
}
inline void solve()
{
    cin >> x >> y;
    ll t = 1ll * x * y, f = sqrt(t); siz = 0;
    ll ff = t;
    L(i, 2, f)
        if(ff % i == 0)
        {
            F[++siz] = i;
            while(ff % i == 0) ff /= i;
        }
    if(ff != 1)
    {
        if(ff == t) {cout << "0\n0\n"; return ;}
        F[++siz] = ff;
    }
    R(i, max(1ll, f), 1)
    {
        if(t % i != 0) continue;
        a = i, b = t / i;
        if(a == x || a == y) continue;
        if(x % a == 0 && y % a == 0 && x % b == 0 && y % b == 0) get(x, y, a, b);
        else work();
        return ;
    }
    cout << "0\n0\n";
    // puts("0"); puts("0");
    return ;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> T;
    L(i, 1, T) solve();
    return 0;
}

Details

In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148,
                 from /usr/include/c++/11/ext/atomicity.h:35,
                 from /usr/include/c++/11/bits/ios_base.h:39,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:7:
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:102:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  102 | __gthrw(pthread_once)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:102:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:103:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  103 | __gthrw(pthread_getspecific)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:103:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:104:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  104 | __gthrw(pthread_setspecific)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:104:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:106:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  106 | __gthrw(pthread_create)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:106:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:107:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  107 | __gthrw(pthread_join)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:107:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:108:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  108 | __gthrw(pthread_equal)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:108:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:109:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  109 | __gthrw(pthread_self)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:109:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:110:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  110 | __gthrw(pthread_detach)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:110:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:112:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  112 | __gthrw(pthread_cancel)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:112:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:114:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  114 | __gthrw(sched_yield)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:114:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:116:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  116 | __gthrw(pthread_mutex_lock)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:116:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:117:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  117 | __gthrw(pthread_mutex_trylock)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:117:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:119:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
  119 | __gthrw(pthread_mutex_timedlock)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:119:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute
/usr/...