제출 #210434

#제출 시각아이디문제언어결과실행 시간메모리
210434FashoProsjecni (COCI16_prosjecni)C++14
120 / 120
6 ms380 KiB
#include <bits/stdc++.h> #define N 1000005 #define ll long long int #define MP make_pair #define pb push_back #define ppb pop_back #define sp " " #define endl "\n" #define fi first #define se second #define ii pair<int,int> #define lli pair<ll,ll> #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout); #define mod 1000000007 #define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i] #define fo(i,x,y) for(ll i=x;i<=y;i++) #define INF 1000000000005 #define ull unsigned long long int using namespace std; ll n,m,ar[N],sum,t,x,y,z; int main() { fast; cin>>n; if(n==2) return cout<<-1,0; for(int i=1;i<n;i++) y+=i; z=y; ll x=1; fo(i,1,n*(n-1)) { if(i%n==0) { x=z; z+=y; cout<<x++<<endl; continue; } cout<<x++<<sp; } // cout<<endl; ll top=1; fo(i,1,n-1) sum+=top,top+=y; top-=y; top*=n; top-=sum; for(int i=1;i<n;i++) cout<<top+i-1<<sp; cout<<top+(y)-1; }
#Verdict Execution timeMemoryGrader output
Fetching results...