Submission #974803

#TimeUsernameProblemLanguageResultExecution timeMemory
974803IsamStone Arranging 2 (JOI23_ho_t1)C++17
60 / 100
2029 ms15712 KiB
#include<bits/stdc++.h>
using namespace std;

#define eb emplace_back

constexpr int sz = 200005;

int n, a[sz], fa[sz];

unordered_map<int, int> mp;

int op[sz], co(1);

signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for(register int i = 1; i <= n; ++i){
		cin >> a[i];
		op[i] = a[i];
	}
	
	for(register int i = 1; i <= n; ++i){
		
		if(op[mp[a[i]]] != a[i] || mp[a[i]] == 0){
			mp[a[i]] = i;
			continue;
		}
		
		int r = i;
		while(r >= mp[a[i]]){
			op[r--] = a[i];
		}
		
		
		
		mp[a[i]] = i;
	}
	
	for(register int i = 1; i <= n; ++i){
		cout << op[i] << '\n';
	}
	
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:17:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |  for(register int i = 1; i <= n; ++i){
      |                   ^
Main.cpp:22:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |  for(register int i = 1; i <= n; ++i){
      |                   ^
Main.cpp:39:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   39 |  for(register int i = 1; i <= n; ++i){
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...