QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#249497#7686. The Phantom MenaceLYT0122Compile Error//C++145.9kb2023-11-12 10:49:482024-10-07 16:37:23

Judging History

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

  • [2024-10-08 14:11:03]
  • hack成功,自动添加数据
  • (/hack/941)
  • [2024-10-08 10:05:28]
  • hack成功,自动添加数据
  • (/hack/940)
  • [2024-10-07 19:51:15]
  • hack成功,自动添加数据
  • (/hack/938)
  • [2024-10-07 19:28:01]
  • hack成功,自动添加数据
  • (/hack/937)
  • [2024-10-07 17:16:32]
  • hack成功,自动添加数据
  • (/hack/936)
  • [2024-10-07 16:53:09]
  • hack成功,自动添加数据
  • (/hack/935)
  • [2024-10-07 16:37:23]
  • 自动重测本题所有获得100分的提交记录
  • [2024-10-07 16:22:17]
  • hack成功,自动添加数据
  • (/hack/934)
  • [2023-11-12 10:49:49]
  • 评测
  • 测评结果:100
  • 用时:773ms
  • 内存:522720kb
  • [2023-11-12 10:49:48]
  • 提交

answer

#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
#include <iostream>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
const int N=1e6+9,INF=1e9,M=1e7+9;
const double eps=1e-5;
typedef pair <int,int> PII;
typedef unsigned long long ull;
const ull base=13331;
inline int read()
{
    int x=0,f=1;char c=getchar();
    while(c<'0' || c>'9') {if(c=='-') f=-1;c=getchar();}
    while(c>='0' && c<='9') {x=x*10+c-48,c=getchar();}
    return x*f;
}
inline ll readll()
{
    ll x=0,f=1;char c=getchar();
    while(c<'0' || c>'9') {if(c=='-') f=-1;c=getchar();}
    while(c>='0' && c<='9') {x=x*10+c-48,c=getchar();}
    return x*f;
}
int T,n,m,deg[N],ans[M],cnt,tmp1[N],tmp2[N],c1,c2;
bool vis[M];
ull pw[N];
vector <ull> ha[N<<1],vt;
vector <PII> g[M];
string s;
ull get(int i,int l,int r)
{
    if(l>r) return 0;
    return ha[i][r]-ha[i][l-1]*pw[r-l+1];
}
void dfs(int u)//欧拉回路
{
    for(int i=(int)g[u].size()-1;i>=0;i=(int)g[u].size()-1)
    {
        PII p=g[u][i];
        g[u].pop_back();
        if(vis[p.second]) continue;
        dfs(p.first);
        vis[p.second]=true,ans[++cnt]=p.second;
    }
}
int main()
{
    // #define FILEIO
    #ifdef FILEIO
        freopen("in.in","r",stdin);
        freopen("out.out","w",stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    pw[0]=1;
    for(int i=1;i<=1000000;i++) pw[i]=pw[i-1]*base;
    cin>>T;
    while(T--)
    {
        bool res=false;
        cin>>n>>m;
        cnt=c1=c2=0;
        for(int i=1;i<=2*n;i++)
        {
            cin>>s;
            ha[i].clear(),ha[i].resize(m+1);
            for(int j=1;j<=m;j++) ha[i][j]=ha[i][j-1]*base+s[j-1]-'a';
        }
        ull B=(base<<15);
        for(int i=0;i<m;i++)
        {
            vt.clear();
            for(int j=1;j<=n;j++)
            {
                ull a=get(j,1,i),b=get(j,i+1,m)+B;
                vt.push_back(a),vt.push_back(b);
            }
            for(int j=n+1;j<=n*2;j++)
            {
                ull a=get(j,1,m-i)+B,b=get(j,m-i+1,m);
                vt.push_back(a),vt.push_back(b);
            }
            sort(vt.begin(),vt.end());
            vt.erase(unique(vt.begin(),vt.end()),vt.end());
            int start=0,s=vt.size();
            for(int j=1;j<=s;j++) deg[j]=0,g[j].clear();
            for(int j=1;j<=n;j++)
            {
                ull a=get(j,1,i),b=get(j,i+1,m)+B;
                int p=lower_bound(vt.begin(),vt.end(),a)-vt.begin()+1;
                int q=lower_bound(vt.begin(),vt.end(),b)-vt.begin()+1;
                deg[p]++,deg[q]--,g[p].push_back({q,j}),start=p;
            }
            for(int j=n+1;j<=n*2;j++)
            {
                ull a=get(j,1,m-i)+B,b=get(j,m-i+1,m);
                int p=lower_bound(vt.begin(),vt.end(),a)-vt.begin()+1;
                int q=lower_bound(vt.begin(),vt.end(),b)-vt.begin()+1;
                deg[p]++,deg[q]--,g[p].push_back({q,j});
            }
            bool flag=true;
            for(int j=1;j<=s && flag;j++)
                if(deg[j]!=0) flag=false;//出度与入度不等
            if(flag==false) continue;
            cnt=0;
            for(int j=1;j<=2*n;j++) vis[j]=false;
            dfs(start);
            for(int j=1;j<=2*n && flag;j++)
                if(vis[j]==false) flag=false;
            if(flag==false) continue;
            c1=c2=0;
            for(int j=cnt;j>=1;j--)
            {
                if(ans[j]>n) tmp2[++c2]=ans[j]-n;
                else tmp1[++c1]=ans[j];
            }
            for(int j=1;j<=c1;j++) cout<<tmp1[j]<<" ";
            cout<<'\n';
            for(int j=1;j<=c2;j++) cout<<tmp2[j]<<" ";
            cout<<'\n';
            res=true;
            break;
        }
        if(res==false) cout<<"-1"<<'\n';
    }
    cerr<<endl<<1e3*clock()/CLOCKS_PER_SEC<<"ms";
    return 0;
}

详细

answer.code:22:39: warning: bad option ‘-fwhole-program’ to pragma ‘optimize’ [-Wpragmas]
   22 | #pragma GCC optimize("-fwhole-program")
      |                                       ^
answer.code:29:41: warning: bad option ‘-fstrict-overflow’ to pragma ‘optimize’ [-Wpragmas]
   29 | #pragma GCC optimize("-fstrict-overflow")
      |                                         ^
answer.code:31:41: warning: bad option ‘-fcse-skip-blocks’ to pragma ‘optimize’ [-Wpragmas]
   31 | #pragma GCC optimize("-fcse-skip-blocks")
      |                                         ^
answer.code:45:51: warning: bad option ‘-funsafe-loop-optimizations’ to pragma ‘optimize’ [-Wpragmas]
   45 | #pragma GCC optimize("-funsafe-loop-optimizations")
      |                                                   ^
answer.code:65:17: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   65 | inline int read()
      |                 ^
answer.code:65:17: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:65:17: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:65:17: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:72:18: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   72 | inline ll readll()
      |                  ^
answer.code:72:18: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:72:18: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:72:18: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:85:26: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   85 | ull get(int i,int l,int r)
      |                          ^
answer.code:85:26: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:85:26: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:85:26: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:90:15: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   90 | void dfs(int u)//欧拉回路
      |               ^
answer.code:90:15: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:90:15: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:90:15: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:101:10: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
  101 | int main()
      |          ^
answer.code:101:10: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:101:10: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:101:10: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from answer.code:49:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/string:54:
/usr/include/c++/13/bits/basic_string.h:181:14: note: called from here
  181 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~