QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#815454#9799. Magical Palettetamir#Compile Error//C++20966b2024-12-15 14:34:522024-12-15 14:34:52

Judging History

This is the latest submission verdict.

  • [2024-12-15 14:34:52]
  • Judged
  • [2024-12-15 14:34:52]
  • Submitted

answer

#include<iostream>
using namespace std;

using ll = long long;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n), b(m);
    for(int i = 0; i < n; i++){
        a[i] = i + 1;
    }
    for(int i = 0; i < m; i++) {
        b[i] = 1 + i * 1ll * n;
    }
    ll mod = n * 1ll * m;

    vector<bool> cont(n * m, false);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++) {
            ll c = (a[i] * b[j]) % mod;
            cont[c] = true;
        }
    }

    for(int i = 0; i < n * m; i++) {
        if(!cont[i]) {
            cout << "No\n";
            return;
        }        
    }
    cout << "Yes\n";
    for(auto x : a){
        cout << x << ' ';
    }
    cout << '\n';
    for(auto x : b){
        cout << x << ' ';
    }
    cout << '\n';
}

int main() {
    ios::sync_with_stdio(0); cin.tie(nullptr);

    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:9:5: error: ‘vector’ was not declared in this scope
    9 |     vector<ll> a(n), b(m);
      |     ^~~~~~
answer.code:2:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
answer.code:9:14: error: expected primary-expression before ‘>’ token
    9 |     vector<ll> a(n), b(m);
      |              ^
answer.code:9:16: error: ‘a’ was not declared in this scope
    9 |     vector<ll> a(n), b(m);
      |                ^
answer.code:9:22: error: ‘b’ was not declared in this scope
    9 |     vector<ll> a(n), b(m);
      |                      ^
answer.code:18:12: error: expected primary-expression before ‘bool’
   18 |     vector<bool> cont(n * m, false);
      |            ^~~~
answer.code:22:13: error: ‘cont’ was not declared in this scope; did you mean ‘const’?
   22 |             cont[c] = true;
      |             ^~~~
      |             const
answer.code:27:13: error: ‘cont’ was not declared in this scope; did you mean ‘const’?
   27 |         if(!cont[i]) {
      |             ^~~~
      |             const