Submission #791189

# Submission time Handle Problem Language Result Execution time Memory
791189 2023-07-23T14:32:15 Z vjudge1 Meandian (CEOI06_meandian) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "libmean.h"

using namespace std;

const int N = 103;
int ans[N], ans2[N];
int n;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    n = Init();
    for (int i = 1; i <= (n-4); i++){
        for (int j = i; j <= i+4; j++){
            int tmp = 0, mx = 0, mn = INT_MAX;
            int q[5], ptr = 0;
            for (int k = i; k <= i+4; k++){
                if (k == j){
                    continue;
                }
                ptr++;
                q[ptr] = k;
            }
            int w = Meandian(q[1], q[2], q[3], q[4]);
        }
        tmp += w;
        mx = max(mx, w);
        mn = min(mn, w);
        tmp -= (mx+mn);
        int f = tmp - (mx*2), t = tmp - (mn*2), s = tmp - f - t;
        for (int j = i; j <= i+4; j++){
            int tmp = 0, mx = 0, mn = INT_MAX;
            int q[5], ptr = 0;
            for (int k = i; k <= i+4; k++){
                if (k == j){
                    continue;
                }
                ptr++;
                q[ptr] = k;
            }
            int w = Meandian(q[1], q[2], q[3], q[4]);
            if (w == mx){
                ans[j] = f;
            } else if (w == mn){
                ans[j] = t;
            } else {
                ans[j] = s;
            }
        }
    }
    for (int i = 1; i <= n; i++){
        if (ans[i] == 0){
            ans[i] = -1;
        }
        ans2[i-1] = ans[i];
    }
    Solution(ans2);
}

Compilation message

meandian.cpp: In function 'int main()':
meandian.cpp:16:17: warning: unused variable 'tmp' [-Wunused-variable]
   16 |             int tmp = 0, mx = 0, mn = INT_MAX;
      |                 ^~~
meandian.cpp:16:26: warning: unused variable 'mx' [-Wunused-variable]
   16 |             int tmp = 0, mx = 0, mn = INT_MAX;
      |                          ^~
meandian.cpp:16:34: warning: unused variable 'mn' [-Wunused-variable]
   16 |             int tmp = 0, mx = 0, mn = INT_MAX;
      |                                  ^~
meandian.cpp:25:17: warning: unused variable 'w' [-Wunused-variable]
   25 |             int w = Meandian(q[1], q[2], q[3], q[4]);
      |                 ^
meandian.cpp:27:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   27 |         tmp += w;
      |         ^~~
      |         tm
meandian.cpp:27:16: error: 'w' was not declared in this scope
   27 |         tmp += w;
      |                ^
meandian.cpp:28:9: error: 'mx' was not declared in this scope
   28 |         mx = max(mx, w);
      |         ^~
meandian.cpp:29:9: error: 'mn' was not declared in this scope; did you mean 'n'?
   29 |         mn = min(mn, w);
      |         ^~
      |         n
meandian.cpp:46:26: error: 't' was not declared in this scope
   46 |                 ans[j] = t;
      |                          ^
meandian.cpp:48:26: error: 's' was not declared in this scope
   48 |                 ans[j] = s;
      |                          ^
meandian.cpp:33:17: warning: unused variable 'tmp' [-Wunused-variable]
   33 |             int tmp = 0, mx = 0, mn = INT_MAX;
      |                 ^~~