Submission #1094665

#TimeUsernameProblemLanguageResultExecution timeMemory
1094665_unknown_2010Colors (BOI20_colors)C++17
0 / 100
1 ms348 KiB
//#ifndef LOCAL //#pragma GCC optimize ("Ofast") //#pragma GCC optimize ("unroll-loops") //#endif #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T> using indexed_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; #define vecm(a,n,m) vector<vector<int>>a(n,vector<int>(m,0)); #define int int64_t #define pii pair<int,int> #define vi vector #define vii vector<pii> #define mpii map<int,int> #define lb lower_bound #define ub upper_bound #define foor(i,a,b) for(int i=a;i<b; i++) #define foor(i,a) foor(i,0,a) #define ss second #define ff first #define ln(x) int(x.size()) #define all(x) (x).begin(), (x).end() #define seea(a,n) for(int i=0;i<n;i++){cin>>a[i];} const int mod = 1E9+7; const int MAXN=200000; const int inf=1e18; const int LOG=21; void solution(){ int n; cin >> n; int l=1,r=n; while(l<r){ int mid=(l+r)/2; cout << "? " << 1 << endl; int a,b; cin >> a; cout << "? " << mid+1 << endl; cin >> b; if(b)r=mid; else l=mid+1; } cout << "= " << l << endl; } int32_t main(){ clock_t tStart = clock(); std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int q = 1; // cin >> q; while(q--) { solution(); cout << '\n'; } cerr<<fixed<<setprecision(3)<<"\nTime Taken: "<<(double)(clock()- tStart)/CLOCKS_PER_SEC << " ms" << endl; } /* ██╗░░██╗██╗░░██╗░█████╗░░██████╗░░░░░░░█████╗░░░███╗░░░█████╗░ ██║░██╔╝██║░░██║██╔══██╗██╔════╝░░░░░░██╔══██╗░████║░░██╔══██╗ █████═╝░███████║██║░░██║╚█████╗░█████╗██║░░██║██╔██║░░╚██████║ ██╔═██╗░██╔══██║██║░░██║░╚═══██╗╚════╝██║░░██║╚═╝██║░░░╚═══██║ ██║░╚██╗██║░░██║╚█████╔╝██████╔╝░░░░░░╚█████╔╝███████╗░█████╔╝ ╚═╝░░╚═╝╚═╝░░╚═╝░╚════╝░╚═════╝░░░░░░░░╚════╝░╚══════╝░╚════╝░ */

Compilation message (stderr)

Colors.cpp:22: warning: "foor" redefined
   22 | #define foor(i,a) foor(i,0,a)
      | 
Colors.cpp:21: note: this is the location of the previous definition
   21 | #define foor(i,a,b) for(int i=a;i<b; i++)
      |
#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...