编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#47001 #1145. ddd 和渡渡鸟 Compile Error 0 0 ms 0 K C++ / 890 B gggg 2020-12-24 10:15:00
显示原始代码
#ifdef D
#include "hpp.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

using ll = long long;

queue<ll> q;
ll a, b, k, m;

int main() {
    scanf("%lld%lld", &a, &b);
    m = a + b - gcd(a, b);

    vector<vector<ll>> g(m);
    vector<ll> i(m), s(m);

    for (ll j = 0; j < m; ++j) {
        if (j >= a) {
            g[j - a].push_back(j);
            ++i[j];
        }
        if (j < m - b) {
            g[j + b].push_back(j);
            ++i[j];
        }
        if (i[j] == 0) {
            q.push(j);
        }
    }
    for (ll c = 0; !q.empty(); q.pop()) {
        s[k = q.front()] = c++;
        for (ll j : g[k]) {
            if (--i[j] == 0) {
                q.push(j);
            }
        }
    }
    printf("%lld\n", m - 1);
    for (ll j = 1; j < m; ++j) {
        printf("%lld ", s[j] - s[j - 1]);
    }
}

编译信息

/sandbox/1/a.cpp:9:7: error: expected nested-name-specifier before 'll'
 using ll = long long;
       ^~
/sandbox/1/a.cpp:11:7: error: 'll' was not declared in this scope
 queue<ll> q;
       ^~
/sandbox/1/a.cpp:11:9: error: template argument 1 is invalid
 queue<ll> q;
         ^
/sandbox/1/a.cpp:11:9: error: template argument 2 is invalid
/sandbox/1/a.cpp:12:1: error: 'll' does not name a type
 ll a, b, k, m;
 ^~
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:15:24: error: 'a' was not declared in this scope
     scanf("%lld%lld", &a, &b);
                        ^
/sandbox/1/a.cpp:15:28: error: 'b' was not declared in this scope
     scanf("%lld%lld", &a, &b);
                            ^
/sandbox/1/a.cpp:16:5: error: 'm' was not declared in this scope
     m = a + b - gcd(a, b);
     ^
/sandbox/1/a.cpp:16:17: error: 'gcd' was not declared in this scope
     m = a + b - gcd(a, b);
                 ^~~
/sandbox/1/a.cpp:16:17: note: suggested alternative: 'gcvt'
     m = a + b - gcd(a, b);
                 ^~~
                 gcvt
/sandbox/1/a.cpp:18:19: error: 'll' was not declared in this scope
     vector<vector<ll>> g(m);
                   ^~
/sandbox/1/a.cpp:18:27: error: a function call cannot appear in a constant-expression
     vector<vector<ll>> g(m);
                           ^
/sandbox/1/a.cpp:18:27: error: template argument 1 is invalid
/sandbox/1/a.cpp:18:27: error: template argument 2 is invalid
/sandbox/1/a.cpp:18:12: error: template argument 1 is invalid
     vector<vector<ll>> g(m);
            ^~~~~~~~~~~~~~~~
/sandbox/1/a.cpp:18:12: error: template argument 2 is invalid
/sandbox/1/a.cpp:19:14: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
     vector<ll> i(m), s(m);
              ^
/sandbox/1/a.cpp:19:14: note:   expected a type, got 'll'
/sandbox/1/a.cpp:19:14: error: template argument 2 is invalid
/sandbox/1/a.cpp:21:12: error: expected ';' before 'j'
     for (ll j = 0; j < m; ++j) {
            ^~
            ;
/sandbox/1/a.cpp:21:20: error: 'j' was not declared in this scope
     for (ll j = 0; j < m; ++j) {
                    ^
/sandbox/1/a.cpp:23:13: error: 'g' was not declared in this scope
             g[j - a].push_back(j);
             ^
/sandbox/1/a.cpp:27:13: error: 'g' was not declared in this scope
             g[j + b].push_back(j);
             ^
/sandbox/1/a.cpp:31:15: error: request for member 'push' in 'q', which is of non-class type 'int'
             q.push(j);
               ^~~~
/sandbox/1/a.cpp:34:12: error: expected ';' before 'c'
     for (ll c = 0; !q.empty(); q.pop()) {
            ^~
            ;
/sandbox/1/a.cpp:34:23: error: request for member 'empty' in 'q', which is of non-class type 'int'
     for (ll c = 0; !q.empty(); q.pop()) {
                       ^~~~~
/sandbox/1/a.cpp:34:34: error: request for member 'pop' in 'q', which is of non-class type 'int'
     for (ll c = 0; !q.empty(); q.pop()) {
                                  ^~~
/sandbox/1/a.cpp:35:11: error: 'k' was not declared in this scope
         s[k = q.front()] = c++;
           ^
/sandbox/1/a.cpp:35:17: error: request for member 'front' in 'q', which is of non-class type 'int'
         s[k = q.front()] = c++;
                 ^~~~~
/sandbox/1/a.cpp:35:28: error: 'c' was not declared in this scope
         s[k = q.front()] = c++;
                            ^
/sandbox/1/a.cpp:36:16: error: expected ';' before 'j'
         for (ll j : g[k]) {
                ^~
                ;
/sandbox/1/a.cpp:41:5: error: expected primary-expression before '}' token
     }
     ^
/sandbox/1/a.cpp:40:10: error: expected ';' before '}' token
         }
          ^
          ;
     }
     ~     
/sandbox/1/a.cpp:41:5: error: expected primary-expression before '}' token
     }
     ^
/sandbox/1/a.cpp:40:10: error: expected ')' before '}' token
         }
          ^
          )
     }
     ~     
/sandbox/1/a.cpp:36:13: note: to match this '('
         for (ll j : g[k]) {
             ^
/sandbox/1/a.cpp:41:5: error: expected primary-expression before '}' token
     }
     ^
/sandbox/1/a.cpp:43:12: error: expected ';' before 'j'
     for (ll j = 1; j < m; ++j) {
            ^~
            ;
/sandbox/1/a.cpp:43:20: error: 'j' was not declared in this scope
     for (ll j = 1; j < m; ++j) {
                    ^