Submission #375211

#TimeUsernameProblemLanguageResultExecution timeMemory
375211kiomiSifra (COCI21_sifra)C++17
50 / 50
1 ms364 KiB
//order_of_key(k): Number of items strictly smaller than k . //find_by_order(k): K-th element in a set (counting from zero). #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define full(x,n) x,x+n+1 #define full(x) x.begin(),x.end() #define f first #define s second #define len(x) (int)x.size() //logx(a^n)=loga(a^n)/logx(a) //logx(a*b)=logx(a)+logx(b) //logx(y)=log(y)/log(x) //logb(n)=loga(n)/loga(b) #define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> //(a+b)^n=sum of C(n,i)*a^i*b^(n-i) 0<=i<=n //(a-b)^n=sum of C(n,i)*a^i*b^(n-i) for even i-for odd i // 1/b%mod=b^(m-2)%mod // (a>>x)&1==0 // a^b=(a+b)-2(a&b) typedef double db; typedef long long ll; //sum of squares n*(n+1)*(2n+1)/6 //sum of cubes [n*(n+1)/2]^2 //sum of squares for odds n*(4*n*n-1)/3 //sum of cubes for odds n*n*(2*n*n-1) const int ary=1e6+5; const int mod=1e9+7; const ll inf=1e18; using namespace std; using namespace __gnu_pbds; string s; int cnt[ary],ans; int main(){ ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>s; int knt=0; for(int i=0;i<len(s);i++){ if(s[i]>='0'&&s[i]<='9'){ knt=knt*10+(s[i]-'0'); if(i==len(s)-1||(s[i+1]<'0'||s[i+1]>'9')){ cnt[knt]++; if(cnt[knt]==1){ ans++; } knt=0; } } } cout<<ans; }

Compilation message (stderr)

Main.cpp:7: warning: "full" redefined
    7 | #define full(x) x.begin(),x.end()
      | 
Main.cpp:6: note: this is the location of the previous definition
    6 | #define full(x,n) x,x+n+1
      |
#Verdict Execution timeMemoryGrader output
Fetching results...