# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1044828 | 2024-08-05T14:01:35 Z | vjudge1 | Strange Device (APIO19_strange_device) | C++17 | 2197 ms | 524288 KB |
#include<bits/stdc++.h> #define int long long #define MOD 1000000007 #define all(x) x.begin(),x.end() #define ff fir -st #define ss second #define pb push_back #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using namespace std; int32_t main(){ int n,a,b; cin>>n>>a>>b; set<pair<int,int>>st; map<pair<int,int>,int>mp; for(int i=0;!st.count(make_pair((i+i/b)%a,i%b));i++){ st.insert(make_pair((i+i/b)%a,i%b)); mp[make_pair((i+i/b)%a,i%b)]=i; } vector<int>pre(st.size()+5); for(int i=0;i<n;i++){ int l,r; cin>>l>>r; if(r-l+1>=st.size()){ cout<<st.size()<<endl; return 0; } int x=mp[make_pair((l+l/b)%a,l%b)],y=mp[make_pair((r+r/b)%a,r%b)]; if(x>y){ pre[0]++; pre[y+1]--; pre[x]++; pre[st.size()]--; } else{ pre[x]++; pre[y+1]--; } } int ans=0; for(int i=0;i<st.size();i++){ pre[i]+=(i==0?0:pre[i-1]); ans+=(pre[i]!=0); } cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Runtime error | 1057 ms | 524288 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Runtime error | 2197 ms | 524288 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 535 ms | 128400 KB | Output is correct |
3 | Correct | 456 ms | 130080 KB | Output is correct |
4 | Correct | 448 ms | 108136 KB | Output is correct |
5 | Correct | 1012 ms | 142972 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1507 ms | 179496 KB | Output is correct |
3 | Runtime error | 1767 ms | 524288 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1507 ms | 179496 KB | Output is correct |
3 | Runtime error | 1767 ms | 524288 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1507 ms | 179496 KB | Output is correct |
3 | Runtime error | 1767 ms | 524288 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Runtime error | 1252 ms | 524288 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Runtime error | 1057 ms | 524288 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |