Rudro_Debnath

Untitled

Oct 17th, 2021
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <ext/pb_ds/assoc_container.hpp>
  3. #include <ext/pb_ds/tree_policy.hpp>
  4. using namespace std;
  5. using namespace __gnu_pbds;
  6.  
  7. #define mxx 1e18
  8. #define mnn -1e18
  9. //#define int long long
  10. #define Y() cout<< "YES" <<endl
  11. #define N() cout << "NO"<<endl
  12. //#define endl "\n"
  13. #define Ceil(x,y) ((x+y-1)/y)
  14. #define sz(s) (int)s.size()
  15. #define angle(x) double(x * acos(-1) / 180.0)
  16. #define max_3(a,b,c) max(a, max(b,c))
  17. #define min_3(a,b,c) min(a, min(b,c))
  18. #define gcd(a,b) __gcd(a,b)
  19. #define lcm(a,b) (a*b)/gcd(a,b)
  20. #define ll long long
  21. #define PI acos(-1)
  22. #define mem(a,v) memset(a,v,sizeof(a))
  23. #define SORT(v) sort(v.begin(),v.end())
  24. #define REV(v) reverse(v.begin(),v.end())
  25. #define B begin()
  26. #define E end()
  27. #define V vector
  28. #define F first
  29. #define S second
  30. #define PSB push_back
  31. #define MP make_pair
  32. #define flash cout.flush()
  33. #define InTheNameOfGod ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
  34.  
  35. template <typename T>
  36. using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
  37. //ordered_set<ll> s;
  38. //*s.find_by_order(x) //val at x index in sorted order.
  39. //s.order_of_key(x); //index of x or if not find x , it show index no in sort array.
  40.  
  41.  
  42. constexpr ll MOD = 998244353;
  43. constexpr ll mod = 1e9 + 7;
  44. const double eps = 1e-7;
  45. int dx[] = {0,0,1,-1};
  46. int dy[] = {1,-1,0,0};
  47. /*-----*/
  48. #define bug1(a) cerr<<a<<endl;
  49. #define bug2(a,b) cerr<<a<<" "<<b<<endl;
  50. #define bug3(a,b,c) cerr<<a<<" "<<b<<" "<<c<<endl;
  51. /*----*/
  52. const ll N=3e6+5;
  53. vector<ll> adj[N];
  54. ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
  55. ll modpow(ll a,ll b,ll m){ll ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
  56. ll nsum(ll num){return (num*(num+1))/2;}
  57. void edge (ll u,ll v) {adj[u].PSB(v) ;adj[v].PSB(u);}
  58. /*------------------START---------------------*/
  59. //memset(dp,0x3f,sizeof dp); //3d_dp
  60. ll c;
  61. ll ans[N];
  62.  
  63. /*-----*/
  64. void solve(){
  65. ll n,m;
  66. string s;
  67. cin>>n;
  68. ll val=-1;
  69. ll ct=0;
  70. while(1){
  71. cout<<"?";
  72. for(ll i=0;i<n-1;i++) cout<<" "<<"0";
  73. cout<<" "<<++ct<<endl;
  74. ll x; cin>>x;
  75. if(x==0){
  76. val= n-ct+1;
  77. ans[n]= val;
  78. cout<<val<<endl;
  79. break;
  80. }
  81. }
  82. //return;
  83. for(ll i=val+1;i<=n;i++){
  84. ll baki= i-val;
  85. cout<<"?";
  86. for(ll i=0;i<n-1;i++) cout<<" "<<0;
  87. cout<<" "<<baki<<endl;
  88. ll xx; cin>>xx;
  89. ans[xx]=i;
  90. }
  91.  
  92. for(ll i=1;i<val;i++){
  93. //ll baki= i-val;
  94. cout<<"?";
  95. for(ll j=0;j<n-1;j++) cout<<" "<<i;
  96. cout<<" "<<0<<endl;
  97.  
  98. ll xx; cin>>xx;
  99. ans[xx]=val-i;
  100. }
  101.  
  102. cout<<"!";
  103. for(ll i=1;i<=n;i++)
  104. cout<<" "<<ans[i];
  105. cout<<endl;
  106.  
  107.  
  108.  
  109. //cout << fixed << setprecision(10);
  110. }
  111. /*-----*/
  112. //signed main(){
  113. int main(){
  114. InTheNameOfGod
  115. // freopen("input.txt","r",stdin);
  116. // freopen("output.txt","w",stdout);
  117. ll Test=1;
  118. //cin>>Test;
  119. while(Test--){
  120. solve();
  121. }
  122. return 0;
  123. }
  124.  
Advertisement
Add Comment
Please, Sign In to add comment