제출 #90382

#제출 시각아이디문제언어결과실행 시간메모리
90382NordwayGift (IZhO18_nicegift)C++14
0 / 100
6 ms3752 KiB
#include <bits/stdc++.h> #define x first #define y second #define pb push_back #define mp make_pair #define up_b upper_bound #define low_b lower_bound #define sz(x) (int)x.size() #define all(v) v.begin(),v.end() #define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<int,ll> pil; typedef pair<ll,int> pli; typedef pair<ll,ll> pll; const ll INF = 1e18; const ll inf = 1e9; const int mod = 998244353; const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; const int N = 2e5+5; const int M = 1e5+1; pii a[N]; int main(){ int n,k; cin>>n>>k; int m=n; for(int i=1;i<=n;i++){ cin>>a[i].x; a[i].y=i; } sort(a+1,a+n+1); int l=1,r=2; vector< pair<int,pii> >ans; bool w=0; while(1){ if(l==n){ w=1; break; } if(l>n)break; int val=a[l].x; ans.pb(mp(val,mp(a[l].y,a[r].y))); l++; if(a[r].x==val)r+=2,l++; else r++; } if(w)cout<<"-1"; else{ cout<<sz(ans)<<endl; for(int i=0;i<sz(ans);i++){ cout<<ans[i].x<<" "<<ans[i].y.x<<" "<<ans[i].y.y<<endl; } } }

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

nicegift.cpp: In function 'int main()':
nicegift.cpp:34:6: warning: unused variable 'm' [-Wunused-variable]
  int m=n;
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...