Submission #19724846
Source Code Expand
Copy
#include <iostream> using namespace std; int N,M,T,time,last; int main() { cin>>N>>M>>T; last=N; for(int i=1;i<=M;i++) { int A,B; cin>>A>>B; last-=A-time; if(last<1){ cout<<"No"; return 0; } time=B; last+=B-A; if(last>=N) last=N; } last-=T-time; if(last<1) cout<<"No"; else cout<<"Yes"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Smartphone Addiction |
User | PETERZ |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 449 Byte |
Status | CE |
Compile Error
./Main.cpp:3:11: error: ‘int time’ redeclared as different kind of entity 3 | int N,M,T,time,last; | ^~~~ In file included from /usr/include/pthread.h:24, from /usr/include/x86_64-linux-gnu/c++/9/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/9/bits/gthr.h:148, from /usr/include/c++/9/ext/atomicity.h:35, from /usr/include/c++/9/bits/ios_base.h:39, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from ./Main.cpp:1: /usr/include/time.h:75:15: note: previous declaration ‘time_t time(time_t*)’ 75 | extern time_t time (time_t *__timer) __THROW; | ^~~~ ./Main.cpp: In function ‘int main()’: ./Main.cpp:12:13: error: invalid operands of types ‘int’ and ‘time_t(time_t*) noexcept’ {aka ‘long int(long int*) noexcept’} to binary ‘operator-’ 12 | last-=A-time; | ~^~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | int ./Main.cpp:17:10: error: assignment of function ‘time_t time(time_t*)’ 17 | time=B; | ~~~~^~ ./Main.cpp:22:12: error: invalid operands of types ‘int’ and ‘time_t(time_t*) noexcept’ {aka ‘long int(long int*) noexcept’} to binary ‘operator-’ 22 | last-=T-time; | ~^~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | int