QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103601#6348. Egor Has a ProblemSEM_PRESSAO_pedroteosousa#Compile Error//C++232.4kb2023-05-07 03:10:092023-05-07 03:10:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-07 03:10:11]
  • 评测
  • [2023-05-07 03:10:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }
    int first = -1, last = -1;
    for (int i = 1; i < n; i++) {
        if ((a[i] / a[i - 1]) == 1ll) {
            if (first == -1)
                first = i;
            last = i;
        }
    }
    if (last - first >= 2) {
        printf("YES\n");
        printf("%d %d %d %d\n", first, first + 1, last, last + 1);
        return 0;
    }
    if (n >= 1000) {
        printf("NO\n");
        return 0;
    }
    map<long long, pair<int, int>> f, l;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < i; j++) {
            long long x = a[i] / a[j];
            if (f.find(x) == f.end())
                f[x] = {j + 1, i + 1};
            l[x] = {j + 1, i + 1};
        }
    }
    for (auto x: f) {
        auto y = l[x.first];
        if (y.first > x.second.second) {
            printf("YES\n");
            printf("%d %d %d %d\n", x.second.first, x.second.second, y.first, y.second);
            return 0;
        }
    }
    printf("NO\n");
    return 0;#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }
    int first = -1, last = -1;
    for (int i = 1; i < n; i++) {
        if ((a[i] / a[i - 1]) == 1ll) {
            if (first == -1)
                first = i;
            last = i;
        }
    }
    if (last - first >= 2) {
        printf("YES\n");
        printf("%d %d %d %d\n", first, first + 1, last, last + 1);
        return 0;
    }
    if (n >= 1000) {
        printf("NO\n");
        return 0;
    }
    map<long long, pair<int, int>> f, l;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < i; j++) {
            long long x = a[i] / a[j];
            if (f.find(x) == f.end())
                f[x] = {j + 1, i + 1};
            l[x] = {j + 1, i + 1};
        }
    }
    for (auto x: f) {
        auto y = l[x.first];
        if (y.first > x.second.second) {
            printf("YES\n");
            printf("%d %d %d %d\n", x.second.first, x.second.second, y.first, y.second);
            return 0;
        }
    }
    printf("NO\n");
    return 0;
}
}

详细

answer.code:45:14: error: stray ‘#’ in program
   45 |     return 0;#include <bits/stdc++.h>
      |              ^
answer.code: In function ‘int main()’:
answer.code:45:24: error: ‘bits’ was not declared in this scope
   45 |     return 0;#include <bits/stdc++.h>
      |                        ^~~~
answer.code:45:29: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
   45 |     return 0;#include <bits/stdc++.h>
      |                             ^~~~
      |                             std
answer.code:45:15: error: ‘include’ was not declared in this scope
   45 |     return 0;#include <bits/stdc++.h>
      |               ^~~~~~~
answer.code:46:1: error: expected primary-expression before ‘using’
   46 | using namespace std;
      | ^~~~~
answer.code:48:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   48 | int main() {
      |         ^~
answer.code:48:9: note: remove parentheses to default-initialize a variable
   48 | int main() {
      |         ^~
      |         --
answer.code:48:9: note: or replace parentheses with braces to value-initialize a variable
answer.code:48:12: error: a function-definition is not allowed here before ‘{’ token
   48 | int main() {
      |            ^
answer.code:5:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     int n; scanf("%d", &n);
      |            ~~~~~^~~~~~~~~~
answer.code:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%lld", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~~~