Submission #887041

#TimeUsernameProblemLanguageResultExecution timeMemory
887041PotatoManStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
146 ms15320 KiB
#include <bits/stdc++.h> #define inf INT_MAX #define longlonginf LONG_LONG_MAX #define mod 1000000007 #define MAXN 200005 #define pii pair<ll,ll> #define ll long long #define deb(x) cerr<<"[ "<<#x<<" = "<<x<<" ]"; #define yes() cout<<"YES\n"; #define no() cout<<"NO\n"; using namespace std; ll n,k,m,cur,q,z; ll ans = 0; string subtask; string s; string l,r; void solve(){ cin>>n; ll a[n+5]; for(int i = 1 ; i <= n ; i++){ cin>>a[i]; } map<int,int> mp; for(int i = 1 ; i <= n ; i++) mp[a[i]] = i; for(int i = 1 ; i <= n ;){ int x = i; int y = mp[a[x]]; for(; i <= y ; i++){ cout<<a[x]<<"\n"; } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T = 1; //cin>>T; for(int i = 0 ; i < T ; i++){ //cout<<"Case #"<<i+1<<": "; solve(); } return 0; } /* misread -> missed subtask you thought u declared it huh? not i but x logical operator wrong example/proof thoroughly wrong variables thinking it wrong bruh just try some test case capitals ;-; wrong data structure lol count memory usement corner case oversized array orders statements size initializer while con map -> array wrong digits?? swapped variables?? check if theres any variabled that got declared twice find some pattern name collision constraints??! mod !! resets */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...