QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527198#9156. 百万富翁sumi007#Compile Error//C++142.7kb2024-08-22 11:51:152024-08-22 11:51:16

Judging History

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

  • [2024-08-22 11:51:16]
  • 评测
  • [2024-08-22 11:51:15]
  • 提交

answer

#include "richest.h"
using namespace std;
#define pb push_back
int vis[2077][2077],bel[1000007],p[1000005],B,len; 
set<int> s[10];
vector<int> a,b;
int richest(int N, int T, int S) {
    if(N==1000 && T==1 && S==499500){
        vector<int> a,b,c;
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                a.pb(i),b.pb(j);
            }
        }
        c = ask(a,b);
        for(int i=0;i<c.size();i++){
            int u = a[i],v = b[i],w = c[i];
            if(u == w) vis[u][v] = 1,vis[v][u] = 0;
            else vis[u][v] = 0,vis[v][u] = 1;
        }
        int ans = 0;
        for(int i=0;i<N;i++){
            int ck = 1;
            for(int j=0;j<N;j++){
                if(i==j) continue;
                if(!vis[i][j]) ck = 0;
            }
            if(ck == 1){
                ans = i;
                break;
            }
        }
        return ans;
    }else{
        srand(time(0));
        B = 100000;
        for(int i=0;i<10;i++){
            int l = i*B,r = l+B-1;
            for(int j=l;j<=r;j++) s[i].insert(j),bel[j] = i;
        }
        while(1){
            for(int i=0;i<10;i++) {
                vec[i].clear();
                for(int x:s[i]) vec[i].pb(x);
                random_shuffle(vec.begin(),vec.end());
            }
            vector<int> a,b,c;
            for(int i=0;i<10;i++){
                for(int j=0;j+1<vec[i].size();j++){
                    int u = vec[i][j],v = vec[i][j+1];
                    a.pb(u),b.pb(v);
                }
            } 
            c = ask(a,b);
            for(int i=0;i<c.size();i++){
                int u = a[i],v = b[i],w = c[i];
                if(a[i]>b[i]) s[bel[b[i]]].erase(b[i]);
                else s[bel[a[i]]].erase(a[i]);
            }
            int chk = 1;
            for(int i=0;i<10;i++) chk = chk&(s[i].size()==1);
            if(chk) break;
        }
        vector<int> f;
        for(int i=0;i<10;i++) f.pb(*s[i].begin());
        a.clear(),b.clear(),c.clear();
        for(int i=0;i<10;i++){
            for(int j=i+1;j<10;j++){
                a.pb(i),b.pb(j);
            }
        }
        c = ask(a,b);
        for(int i=0;i<c.size();i++){
            int u = a[i],v = b[i],w = c[i];
            if(u == w) vis[u][v] = 1,vis[v][u] = 0;
            else vis[u][v] = 0,vis[v][u] = 1;
        }
        int ans = 0;
        for(int i=0;i<N;i++){
            int ck = 1;
            for(int j=0;j<N;j++){
                if(i==j) continue;
                if(!vis[i][j]) ck = 0;
            }
            if(ck == 1){
                ans = i;
                break;
            }
        }
        return ans;
    }
}

Details

answer.code:5:1: error: ‘set’ does not name a type
    5 | set<int> s[10];
      | ^~~
answer.code: In function ‘int richest(int, int, int)’:
answer.code:35:15: error: ‘time’ was not declared in this scope
   35 |         srand(time(0));
      |               ^~~~
answer.code:2:1: note: ‘time’ is defined in header ‘<ctime>’; did you forget to ‘#include <ctime>’?
    1 | #include "richest.h"
  +++ |+#include <ctime>
    2 | using namespace std;
answer.code:35:9: error: ‘srand’ was not declared in this scope
   35 |         srand(time(0));
      |         ^~~~~
answer.code:39:35: error: ‘s’ was not declared in this scope
   39 |             for(int j=l;j<=r;j++) s[i].insert(j),bel[j] = i;
      |                                   ^
answer.code:43:17: error: ‘vec’ was not declared in this scope
   43 |                 vec[i].clear();
      |                 ^~~
answer.code:44:27: error: ‘s’ was not declared in this scope
   44 |                 for(int x:s[i]) vec[i].pb(x);
      |                           ^
answer.code:45:17: error: ‘random_shuffle’ was not declared in this scope
   45 |                 random_shuffle(vec.begin(),vec.end());
      |                 ^~~~~~~~~~~~~~
answer.code:49:33: error: ‘vec’ was not declared in this scope
   49 |                 for(int j=0;j+1<vec[i].size();j++){
      |                                 ^~~
answer.code:51:34: error: ‘v’ was not declared in this scope
   51 |                     a.pb(u),b.pb(v);
      |                                  ^
answer.code:57:31: error: ‘s’ was not declared in this scope
   57 |                 if(a[i]>b[i]) s[bel[b[i]]].erase(b[i]);
      |                               ^
answer.code:58:22: error: ‘s’ was not declared in this scope
   58 |                 else s[bel[a[i]]].erase(a[i]);
      |                      ^
answer.code:61:46: error: ‘s’ was not declared in this scope
   61 |             for(int i=0;i<10;i++) chk = chk&(s[i].size()==1);
      |                                              ^
answer.code:65:37: error: ‘s’ was not declared in this scope
   65 |         for(int i=0;i<10;i++) f.pb(*s[i].begin());
      |                                     ^
answer.code:66:29: error: ‘c’ was not declared in this scope
   66 |         a.clear(),b.clear(),c.clear();
      |                             ^