제출 #922312

#제출 시각아이디문제언어결과실행 시간메모리
922312Shayan86Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
80 ms9292 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") // Ofast, O0, O1, O2, O3, unroll-loops, fast-math, trapv typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define Mp make_pair #define sep ' ' #define endl '\n' #define F first #define S second #define pb push_back #define all(x) (x).begin(),(x).end() #define kill(res) cout << res << '\n', exit(0); #define set_dec(x) cout << fixed << setprecision(x); #define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define file_io freopen("input.txt", "r", stdin) ; freopen("output.txt", "w", stdout); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll N = 2e5 + 50; const ll Mod = 1e9 + 7; ll n, a[N], cnt[N]; vector<int> vec, block; int main(){ fast_io; cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; vec.pb(a[i]); } sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin()); for(int i = 1; i <= n; i++) a[i] = lower_bound(all(vec), a[i]) - vec.begin() + 1; block.pb(1); cnt[a[1]]++; for(int i = 2; i <= n; i++){ if(cnt[a[i]]){ while(a[block.back()] != a[i]){ cnt[a[block.back()]]--; block.pop_back(); } } else{ block.pb(i); cnt[a[i]]++; } } block.pb(n+1); for(int i = 0; i < block.size()-1; i++){ for(int j = block[i]; j < block[i+1]; j++) cout << vec[a[block[i]]-1] << endl; } }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for(int i = 0; i < block.size()-1; i++){
      |                    ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...