QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#844097#147. FloppyStarrykillerCompile Error//C++232.2kb2025-01-05 14:37:542025-01-05 14:38:04

Judging History

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

  • [2025-01-05 14:38:04]
  • 评测
  • [2025-01-05 14:37:54]
  • 提交

floppy

// Homura Akemi a.k.a. Starrykiller (/user/235125)
// I love Madoka Kaname forever! 
#include <bits/stdc++.h>
#include "floppy.h"

using namespace std;
// void save_to_floppy(const string& bits) {
//     cout<<bits<<'\n';
// }


auto range(auto l, auto r) { return views::iota(l,r); }
auto rev=views::reverse;

_GLIBCXX_ALWAYS_INLINE void chmax(auto &a, auto b) { a=max(a,b); }
_GLIBCXX_ALWAYS_INLINE void chmin(auto &a, auto b) { a=min(a,b); }


void read_array(int subtask_id, const std::vector<int> &v) {
    string bits;
    vector<int> stk;
    for (auto i: range(0u,size(v))) {
        while (size(stk) && v[stk.back()]<v[i]) bits.push_back('0'), stk.pop_back();
        bits.push_back('1'); stk.push_back(i);
    }
    save_to_floppy(bits);
}

constexpr int MAXN=1e5+10;
int stk[MAXN], top, ls[MAXN], rs[MAXN], vis[MAXN];
vector<int> g[MAXN]; int f[MAXN][19], dep[MAXN];

void dfs(int u, int fa) {
    dep[u]=dep[f[u][0]=fa]+1;
    for (int i=1; f[u][i-1]; ++i)
        f[u][i]=f[f[u][i-1]][i-1];
    for (auto v: g[u]) dfs(v,u);
}

int LCA(int u, int v) {
    if (dep[u]<dep[v]) swap(u,v);
    for (int i=18; ~i; --i) if (dep[f[u][i]]>=dep[v]) u=f[u][i];
    if (u==v) return u;
    for (int i=18; ~i; --i) if (f[u][i]!=f[v][i]) u=f[u][i], v=f[v][i];
    return f[u][0];
}

std::vector<int> solve_queries(int subtask_id, 
    int n, const std::string &bits, 
    const std::vector<int> &a,
    const std::vector<int> &b) {
    fill(ls,ls+n,-1); fill(rs,rs+n,-1);
    auto it=begin(bits);
    for (auto i: range(0,n)) {
        int cur=top;
        while (it!=end(bits) && *it=='0') --cur;
        if (cur) rs[stk[cur]]=i;
        if (cur<top) ls[i]=stk[cur+1];
        stk[top=++cur]=i; ++it;
    }
    for (int i=0; i<n; ++i) {
        if (ls[i]!=-1) g[i+1].emplace_back(ls[i]+1), vis[ls[i]+1]=1;
        if (rs[i]!=-1) g[i+1].emplace_back(rs[i]+1), vis[rs[i]+1]=1;
    }
    int root=0;
    for (int i=1; i<=n; ++i) if (!vis[i]) root=i;
    dfs(root,0);
    vector<int> res;
    for (auto i: range(0u,size(a))) {
        res.push_back(LCA(a[i]+1,b[i]+1)-1);
    }
    return res;
}

// int main() {
//     int sid, n; cin>>sid>>n;
//     vector<int> a(n); for (auto &i: a) cin>>i; 
//     read_array(sid,a);
// }

Details

floppy.code:12:17: error: ‘l’ does not name a type
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      |                 ^
floppy.code:12:25: error: ‘r’ does not name a type
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      |                         ^
floppy.code:12:6: error: ISO C++ forbids declaration of ‘range’ with no type [-fpermissive]
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      |      ^~~~~
floppy.code:12:1: error: top-level declaration of ‘range’ specifies ‘auto’
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      | ^~~~
floppy.code:12:1: error: storage class ‘auto’ invalid for function ‘range’
floppy.code: In function ‘int range(int, int)’:
floppy.code:12:37: error: ‘views’ has not been declared
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      |                                     ^~~~~
floppy.code:12:49: error: ‘l’ was not declared in this scope
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      |                                                 ^
floppy.code:12:51: error: ‘r’ was not declared in this scope
   12 | auto range(auto l, auto r) { return views::iota(l,r); }
      |                                                   ^
floppy.code: At global scope:
floppy.code:13:6: error: ‘rev’ does not name a type
   13 | auto rev=views::reverse;
      |      ^~~
floppy.code:15:41: error: ISO C++ forbids declaration of ‘a’ with no type [-fpermissive]
   15 | _GLIBCXX_ALWAYS_INLINE void chmax(auto &a, auto b) { a=max(a,b); }
      |                                         ^
floppy.code:15:49: error: ‘b’ does not name a type
   15 | _GLIBCXX_ALWAYS_INLINE void chmax(auto &a, auto b) { a=max(a,b); }
      |                                                 ^
floppy.code: In function ‘void chmax(int&, int)’:
floppy.code:15:62: error: ‘b’ was not declared in this scope
   15 | _GLIBCXX_ALWAYS_INLINE void chmax(auto &a, auto b) { a=max(a,b); }
      |                                                              ^
floppy.code: At global scope:
floppy.code:16:41: error: ISO C++ forbids declaration of ‘a’ with no type [-fpermissive]
   16 | _GLIBCXX_ALWAYS_INLINE void chmin(auto &a, auto b) { a=min(a,b); }
      |                                         ^
floppy.code:16:49: error: ‘b’ does not name a type
   16 | _GLIBCXX_ALWAYS_INLINE void chmin(auto &a, auto b) { a=min(a,b); }
      |                                                 ^
floppy.code: In function ‘void chmin(int&, int)’:
floppy.code:16:62: error: ‘b’ was not declared in this scope
   16 | _GLIBCXX_ALWAYS_INLINE void chmin(auto &a, auto b) { a=min(a,b); }
      |                                                              ^
floppy.code: In function ‘void read_array(int, const std::vector<int>&)’:
floppy.code:22:15: error: ‘i’ does not name a type
   22 |     for (auto i: range(0u,size(v))) {
      |               ^
floppy.code:25:6: error: expected ‘;’ before ‘save_to_floppy’
   25 |     }
      |      ^
      |      ;
   26 |     save_to_floppy(bits);
      |     ~~~~~~~~~~~~~~
floppy.code:26:19: error: could not convert ‘save_to_floppy(bits)’ from ‘void’ to ‘bool’
   26 |     save_to_floppy(bits);
      |     ~~~~~~~~~~~~~~^~~~~~
      |                   |
      |                   void
floppy.code:27:1: error: expected primary-expression before ‘}’ token
   27 | }
      | ^
floppy.code:26:26: error: expected ‘)’ before ‘}’ token
   26 |     save_to_floppy(bits);
      |                          ^
      |                          )
   27 | }
      | ~                         
floppy.code:22:9: note: to match this ‘(’
   22 |     for (auto i: range(0u,size(v))) {
      |         ^
floppy.code:27:1: error: expected primary-expression before ‘}’ token
   27 | }
      | ^
floppy.code: At global scope:
floppy.code:29:1: error: ‘constexpr’ does not name a type
   29 | constexpr int MAXN=1e5+10;
      | ^~~~~~~~~
floppy.code:29:1: note: C++11 ‘constexpr’ only available with ‘-std=c++11’ or ‘-std=gnu++11’
floppy.code:30:9: error: ‘MAXN’ was not declared in this scope
   30 | int stk[MAXN], top, ls[MAXN], rs[MAXN], vis[MAXN];
      |         ^~~~
floppy.code:30:24: error: ‘MAXN’ was not declared in this scope
   30 | int stk[MAXN], top, ls[MAXN], rs[MAXN], vis[MAXN];
      |                        ^~~~
floppy.code:30:34: error: ‘MAXN’ was not declared in this scope
   30 | int stk[MAXN], top, ls[MAXN], rs[MAXN], vis[MAXN];
      |                                  ^~~~
floppy.code:30:45: error: ‘MAXN’ was not declared in this scope
   30 | int stk[MAXN], top, ls[MAXN], rs[MAXN], vis[MAXN];
      |                                             ^~~~
floppy.code:31:15: error: ‘MAXN’ was not declared in this scope
   31 | vector<int> g[MAXN]; int f[MAXN][19], dep[MAXN];
      |               ^~~~
floppy.code:31:28: error: ‘MAXN’ was not declared in this scope
   31 | vector<int> g[MAXN]; int f[MAXN][19], dep[MAXN];
      |                     ...