QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#606203#6809. Code With No Forcesbessie_goes_mooCompile Error//C++171.8kb2024-10-02 23:09:302024-10-02 23:09:31

Judging History

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

  • [2024-10-02 23:09:31]
  • 评测
  • [2024-10-02 23:09:30]
  • 提交

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;
}

Details

answer.code:16:18: error: ‘int time [405][7]’ redeclared as different kind of entity
   16 | int n,m,time[N][M],memory[N][M],result_time[M],result_memory[M];
      |                  ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr.h:148,
                 from /usr/include/c++/13/ext/atomicity.h:35,
                 from /usr/include/c++/13/bits/ios_base.h:39,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from answer.code:1:
/usr/include/time.h:75:15: note: previous declaration ‘time_t time(time_t*)’
   75 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
answer.code: In function ‘int main()’:
answer.code:25:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |         time[i][j]=read(),memory[i][j]=read();
      |               ^
answer.code:25:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |         time[i][j]=read(),memory[i][j]=read();
      |                  ^
answer.code:25:19: error: assignment of read-only location ‘*(time + (((sizetype)i) + ((sizetype)j)))’
   25 |         time[i][j]=read(),memory[i][j]=read();
      |         ~~~~~~~~~~^~~~~~~
answer.code:27:53: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |             result_time[j]=max(result_time[j],time[i][j]);
      |                                                     ^
answer.code:27:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |             result_time[j]=max(result_time[j],time[i][j]);
      |                                                        ^
answer.code:27:31: error: no matching function for call to ‘max(int&, time_t (&)(time_t*) noexcept)’
   27 |             result_time[j]=max(result_time[j],time[i][j]);
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/string:51,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
answer.code:27:31: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘time_t(time_t*) noexcept’ {aka ‘long int(long int*) noexcept’})
   27 |             result_time[j]=max(result_time[j],time[i][j]);
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
answer.code:27:31: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘time_t(time_t*) noexcept’ {aka ‘long int(long int*) noexcept’})
   27 |             result_time[j]=max(result_time[j],time[i][j]);
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:37:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |         if(result_time[j]==time[i][j]) w1[i]|=1<<3*j+1;
      |                                  ^
answer.code:37:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |         if(result_time[j]==time[i][j]) w1[i]|=1<<3*j+1;
      |                                     ^
answer.code:37:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |         if(result_time[j]==time[i][j]) w1[i]|=1<<3*j+1;
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~~
answer.code:38:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |         if(result_time[j]<time[i][j]) w2[i]|=1<<3*j+1;
      |                                 ^
answer.code:38:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |         if(result_time[j]<time[i][j]) w2[i]|=1<<3*j+1;
      |                                    ^
answer.code:38:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |         if(result_time[j]<time[i][j]) w2[i]|=1<<3*j+1;
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~