QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606204#6809. Code With No Forcesbessie_goes_mooWA 1ms6436kbC++171.8kb2024-10-02 23:10:532024-10-02 23:10:53

Judging History

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

  • [2024-10-02 23:10:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6436kb
  • [2024-10-02 23:10:53]
  • 提交

answer

#include<iostream>
#include<cstring>
using namespace std;
const int N=405,M=6+1,MS=1<<18|5;
int read(){
    int red=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){ if(ch=='-') f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9') red=red*10+ch-48,ch=getchar();
    return red*f;
}
char getch(){
    char ch=getchar();
    while(ch<'A'||ch>'Z') ch=getchar();
    return ch;
}
int n,m,time_[N][M],memory[N][M],result_time[M],result_memory[M];
int w1[N],w2[N],ans[N];
int f[MS],from_S[MS],from_N[MS];
char output[N][M],result[M];
int main(){
    n=read(),m=read();
    for(int i=1;i<=n;i++)
    for(int j=0;j<m;j++){
        output[i][j]=getch();
        time_[i][j]=read(),memory[i][j]=read();
        if(!result[j]){
            result_time[j]=max(result_time[j],time_[i][j]);
            result_memory[j]=max(result_memory[j],memory[i][j]);
            if(output[i][j]!='O') result[j]=output[i][j];
        }
    }
    for(int j=0;j<m;j++) if(!result[j]) result[j]='O';
    for(int i=1;i<=n;i++)
    for(int j=0;j<m;j++){
        if(result[j]==output[i][j]) w1[i]|=1<<3*j;else
        if(output[i][j]!='O') w2[i]|=1<<3*j;
        if(result_time[j]==time_[i][j]) w1[i]|=1<<3*j+1;
        if(result_time[j]<time_[i][j]) w2[i]|=1<<3*j+1;
        if(result_memory[j]==memory[i][j]) w1[i]|=1<<3*j+2;
        if(result_memory[j]<memory[i][j]) w2[i]|=1<<3*j+2;
    }
    int ts=1<<3*m;
    memset(f,63,sizeof f);f[0]=0;
    for(int s=0;s<ts;s++)
    for(int i=1;i<=n;i++) if((s&w2[i])==w2[i]){
        int ns=s|w1[i];
        if(f[s]+1<f[ns]) f[ns]=f[s]+1,from_S[ns]=s,from_N[ns]=i;
    }
    --ts;
    printf("%d\n",f[ts]);
    while(ts){
        ans[++ans[0]]=from_N[ts];
        ts=from_S[ts];
    }
    for(int i=ans[0];i;i--) printf("%d ",ans[i]);
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 6436kb

input:

2 3
OK,1/1 OK,2/1 OK,2/2
WA,1/1 OK,1/1 TL,1000/1

output:

2
2 1 

result:

wrong answer memory mismatched on file 3