답안 #81468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
81468 2018-10-24T19:14:04 Z inom Simple game (IZhO17_game) C++14
컴파일 오류
0 ms 0 KB
Скопировать
#include <bits/stdc++.h>

#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

using namespace std;

const int N = 100100;

int TN = 1;

multiset<pair<int, int> > st;

int a[N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    /// -------------------------------------
    // fin("game.in"); fout("game.out");
    /// cin >> TN;
    /// -------------------------------------
    int n, m;
    cin >> n >> m;
    if (n <= 1000 && m <= 1000) {
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
        }
        int t, pos, new_val, x;
        for (int i = 1; i <= m; i++) {
            cin >> t;
            if (t == 1) {
                cin >> pos >> new_val;
                a[pos] = new_val;
            }
            else {
                int cnt = 0;
                cin >> x;
                for (int j = 1; j < n; j++) {
                    if ((a[j] <= x && x <= a[j + 1]) || (a[j + 1] <= x && x <= a[j])) {
                        cnt++;
                    }
                }
                cout << cnt << endl;
            }
        }
        return 0;
    }
    else {
    multiset<pair<int, int> > st;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (i > 1) {
            st.insert(make_pair(min(a[i], a[i - 1]), 0));
            st.insert(make_pair(max(a[i], a[i - 1]), INT_MAX));
        }
    }
    int t, h;
    for (int i = 1; i <= m; i++) {
        cin >> t;
        if (t == 2) {
            cin >> h;
            st.insert(make_pair(h, i));
        }
    }
    multiset<pair<int, int> > :: iterator it;
    vector<int> ans(N);
    int cnt = 0;
    for (it = st.begin(); it != st.end(); it++) {
        pair<int, int> p = *it;
        if (p.second == 0) cnt++;
        if (p.second > 0 && p.second < INT_MAX) ans[p.second] = cnt;
        if (p.second == INT_MAX) cnt--;
    }
    for (int i = 1; i <= m; i++) {
        cout << ans[i] << endl;
    }
    }
    return 0;
}

Compilation message

game.cpp:1:1: error: stray '\320' in program
 Скопировать
 ^
game.cpp:1:2: error: stray '\241' in program
 Скопировать
  ^
game.cpp:1:3: error: stray '\320' in program
 Скопировать
   ^
game.cpp:1:4: error: stray '\272' in program
 Скопировать
    ^
game.cpp:1:5: error: stray '\320' in program
 Скопировать
     ^
game.cpp:1:6: error: stray '\276' in program
 Скопировать
      ^
game.cpp:1:7: error: stray '\320' in program
 Скопировать
       ^
game.cpp:1:8: error: stray '\277' in program
 Скопировать
        ^
game.cpp:1:9: error: stray '\320' in program
 Скопировать
         ^
game.cpp:1:10: error: stray '\270' in program
 Скопировать
          ^
game.cpp:1:11: error: stray '\321' in program
 Скопировать
           ^
game.cpp:1:12: error: stray '\200' in program
 Скопировать
            ^
game.cpp:1:13: error: stray '\320' in program
 Скопировать
             ^
game.cpp:1:14: error: stray '\276' in program
 Скопировать
              ^
game.cpp:1:15: error: stray '\320' in program
 Скопировать
               ^
game.cpp:1:16: error: stray '\262' in program
 Скопировать
                ^
game.cpp:1:17: error: stray '\320' in program
 Скопировать
                 ^
game.cpp:1:18: error: stray '\260' in program
 Скопировать
                  ^
game.cpp:1:19: error: stray '\321' in program
 Скопировать
                   ^
game.cpp:1:20: error: stray '\202' in program
 Скопировать
                    ^
game.cpp:1:21: error: stray '\321' in program
 Скопировать
                     ^
game.cpp:1:22: error: stray '\214' in program
 Скопировать
                      ^