Submission #206584

#TimeUsernameProblemLanguageResultExecution timeMemory
206584kshitij_sodani이상한 기계 (APIO19_strange_device)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef int128_t llo; #define a first #define b second #define endl "\n" int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); llo n,a,b; cin>>n>>a>>b; llo x; pair<llo,llo> it; if((b+1)%a==0){ x=a; } else{ x=a*b; } llo aa,bb; set<pair<llo,llo>> ac; for(llo i=0;i<n;i++){ cin>>aa>>bb; aa%=x; bb%=x; if(bb<aa){ ac.insert(mp(aa,x-1)); ac.insert(mp(0,bb)); } else{ ac.insert(mp(aa,bb)); } } vector<pair<llo,llo>> prev; for(auto cc:ac){ if(prev.size()==0){ prev.pb(cc); } else{ if(cc.a>prev.back().b){ prev.pb(cc); } else{ prev[prev.size()-1].b=max(prev[prev.size()-1].b,cc.b); } } } llo tot=0; for(llo i=0;i<prev.size();i++){ tot+=prev[i].b-prev[i].a+1; } cout<<tot<<endl; return 0; }

Compilation message (stderr)

strange_device.cpp:6:9: error: 'int128_t' does not name a type; did you mean 'int32_t'?
 typedef int128_t llo;
         ^~~~~~~~
         int32_t
strange_device.cpp: In function 'int main()':
strange_device.cpp:13:2: error: 'llo' was not declared in this scope
  llo n,a,b;
  ^~~
strange_device.cpp:14:7: error: 'n' was not declared in this scope
  cin>>n>>a>>b;
       ^
strange_device.cpp:14:7: note: suggested alternative: 'yn'
  cin>>n>>a>>b;
       ^
       yn
strange_device.cpp:7:11: error: 'first' was not declared in this scope
 #define a first
           ^
strange_device.cpp:14:10: note: in expansion of macro 'a'
  cin>>n>>a>>b;
          ^
strange_device.cpp:8:12: error: 'second' was not declared in this scope
 #define  b second
            ^
strange_device.cpp:14:13: note: in expansion of macro 'b'
  cin>>n>>a>>b;
             ^
strange_device.cpp:8:12: note: suggested alternative: 'rewind'
 #define  b second
            ^
strange_device.cpp:14:13: note: in expansion of macro 'b'
  cin>>n>>a>>b;
             ^
strange_device.cpp:15:6: error: expected ';' before 'x'
  llo x;
      ^
strange_device.cpp:16:14: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
  pair<llo,llo> it;
              ^
strange_device.cpp:16:14: note:   expected a type, got 'llo'
strange_device.cpp:16:14: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
strange_device.cpp:16:14: note:   expected a type, got 'llo'
strange_device.cpp:18:3: error: 'x' was not declared in this scope
   x=a;
   ^
strange_device.cpp:21:3: error: 'x' was not declared in this scope
   x=a*b;
   ^
strange_device.cpp:25:6: error: expected ';' before 'aa'
  llo aa,bb;
      ^~
strange_device.cpp:26:15: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
  set<pair<llo,llo>> ac;
               ^~~
strange_device.cpp:26:15: note:   expected a type, got 'llo'
strange_device.cpp:26:15: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
strange_device.cpp:26:15: note:   expected a type, got 'llo'
strange_device.cpp:26:18: error: template argument 1 is invalid
  set<pair<llo,llo>> ac;
                  ^~
strange_device.cpp:26:18: error: template argument 2 is invalid
strange_device.cpp:26:18: error: template argument 3 is invalid
strange_device.cpp:27:10: error: expected ';' before 'i'
  for(llo i=0;i<n;i++){
          ^
strange_device.cpp:27:14: error: 'i' was not declared in this scope
  for(llo i=0;i<n;i++){
              ^
strange_device.cpp:27:14: note: suggested alternative: 'it'
  for(llo i=0;i<n;i++){
              ^
              it
strange_device.cpp:28:8: error: 'aa' was not declared in this scope
   cin>>aa>>bb;
        ^~
strange_device.cpp:28:8: note: suggested alternative: 'ac'
   cin>>aa>>bb;
        ^~
        ac
strange_device.cpp:28:12: error: 'bb' was not declared in this scope
   cin>>aa>>bb;
            ^~
strange_device.cpp:28:12: note: suggested alternative: 'b'
   cin>>aa>>bb;
            ^~
            b
strange_device.cpp:29:7: error: 'x' was not declared in this scope
   aa%=x;
       ^
strange_device.cpp:32:7: error: request for member 'insert' in 'ac', which is of non-class type 'int'
    ac.insert(mp(aa,x-1));
       ^~~~~~
strange_device.cpp:33:7: error: request for member 'insert' in 'ac', which is of non-class type 'int'
    ac.insert(mp(0,bb));
       ^~~~~~
strange_device.cpp:36:7: error: request for member 'insert' in 'ac', which is of non-class type 'int'
    ac.insert(mp(aa,bb));
       ^~~~~~
strange_device.cpp:40:18: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
  vector<pair<llo,llo>> prev;
                  ^~~
strange_device.cpp:40:18: note:   expected a type, got 'llo'
strange_device.cpp:40:18: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
strange_device.cpp:40:18: note:   expected a type, got 'llo'
strange_device.cpp:40:21: error: template argument 1 is invalid
  vector<pair<llo,llo>> prev;
                     ^~
strange_device.cpp:40:21: error: template argument 2 is invalid
strange_device.cpp:41:14: error: 'begin' was not declared in this scope
  for(auto cc:ac){
              ^~
strange_device.cpp:41:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from strange_device.cpp:2:
/usr/include/c++/7/valarray:1211:5: note:   'std::begin'
     begin(const valarray<_Tp>& __va)
     ^~~~~
/usr/include/c++/7/valarray:1211:5: note:   'std::begin'
strange_device.cpp:41:14: error: 'end' was not declared in this scope
  for(auto cc:ac){
              ^~
strange_device.cpp:41:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from strange_device.cpp:2:
/usr/include/c++/7/valarray:1231:5: note:   'std::end'
     end(const valarray<_Tp>& __va)
     ^~~
/usr/include/c++/7/valarray:1231:5: note:   'std::end'
strange_device.cpp:42:11: error: request for member 'size' in 'prev', which is of non-class type 'int'
   if(prev.size()==0){
           ^~~~
strange_device.cpp:5:12: error: request for member 'push_back' in 'prev', which is of non-class type 'int'
 #define pb push_back
            ^
strange_device.cpp:43:9: note: in expansion of macro 'pb'
    prev.pb(cc);
         ^~
strange_device.cpp:46:17: error: request for member 'back' in 'prev', which is of non-class type 'int'
    if(cc.a>prev.back().b){
                 ^~~~
strange_device.cpp:5:12: error: request for member 'push_back' in 'prev', which is of non-class type 'int'
 #define pb push_back
            ^
strange_device.cpp:47:10: note: in expansion of macro 'pb'
     prev.pb(cc);
          ^~
strange_device.cpp:50:15: error: request for member 'size' in 'prev', which is of non-class type 'int'
     prev[prev.size()-1].b=max(prev[prev.size()-1].b,cc.b);
               ^~~~
strange_device.cpp:50:41: error: request for member 'size' in 'prev', which is of non-class type 'int'
     prev[prev.size()-1].b=max(prev[prev.size()-1].b,cc.b);
                                         ^~~~
strange_device.cpp:54:6: error: expected ';' before 'tot'
  llo tot=0;
      ^~~
strange_device.cpp:55:10: error: expected ';' before 'i'
  for(llo i=0;i<prev.size();i++){
          ^
strange_device.cpp:55:14: error: 'i' was not declared in this scope
  for(llo i=0;i<prev.size();i++){
              ^
strange_device.cpp:55:14: note: suggested alternative: 'it'
  for(llo i=0;i<prev.size();i++){
              ^
              it
strange_device.cpp:55:21: error: request for member 'size' in 'prev', which is of non-class type 'int'
  for(llo i=0;i<prev.size();i++){
                     ^~~~
strange_device.cpp:56:3: error: 'tot' was not declared in this scope
   tot+=prev[i].b-prev[i].a+1;
   ^~~
strange_device.cpp:58:8: error: 'tot' was not declared in this scope
  cout<<tot<<endl;
        ^~~
strange_device.cpp:16:16: warning: unused variable 'it' [-Wunused-variable]
  pair<llo,llo> it;
                ^~