답안 #279937

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
279937 2020-08-22T12:08:30 Z Haunted_Cpp RMQ (NOI17_rmq) C++17
23 / 100
50 ms 384 KB
/**
 *  author: Haunted_Cpp
**/
 
#include <bits/stdc++.h>
using namespace std;
 
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
 
template<typename T> ostream &operator << (ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream &operator << (ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream &operator << (ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
 
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
 
#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); 
  int n, m;
  cin >> n >> m;
  vector<tuple<int, int, int>> arr(m);
  for (int i = 0; i < m; i++) {
    int st, et, w;
    cin >> st >> et >> w;
    arr[i] = {st, et, w};
  }
  if (n <= 10) {
    vector<int> ans(n);
    iota(ans.begin(), ans.end(), 0);
    do {
      for (int i = 0; i < m; i++) {
        const int st = get<0>(arr[i]);
        const int et = get<1>(arr[i]);
        const int mn = get<2>(arr[i]);
        const int is = *min_element(ans.begin() + st, ans.begin() + et + 1);
        if (is != mn) {
          goto fim;
          break;
        }
      }
      for (auto to : ans) cout << to << ' ';
      return 0;
      fim:;
    } while(next_permutation(ans.begin(), ans.end()));
    for (int i = 0; i < n; i++) {
      cout << -1 << ' ';
    }
    return 0;
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 38 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 50 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 38 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 50 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Incorrect 1 ms 384 KB Unexpected end of file - int32 expected
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 38 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 50 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Incorrect 1 ms 384 KB Unexpected end of file - int32 expected
13 Halted 0 ms 0 KB -