fork(2) download
  1.  
  2.  
  3.  
  4.  
  5.  
  6. #include <iostream>
  7. #include <cstdio>
  8. #include <set>
  9. #include <map>
  10. #include <algorithm>
  11. #include <cstdlib>
  12. #include <vector>
  13. #include <cmath>
  14. #include <string>
  15. #include <cstring>
  16. #include <queue>
  17. #include <stack>
  18. #include <deque>
  19. #include <iomanip>
  20. #include <bitset>
  21.  
  22. using namespace std;
  23.  
  24. #define ll long long
  25. #define forn(i, n) for(int (i) = 0; (i) < (n); ++(i))
  26. #define mp make_pair
  27. #define pb push_back
  28. #define F first
  29. #define S second
  30.  
  31. ll inf = 1e18 + 7;
  32. ll mod = 1e9 + 7;
  33.  
  34. #define eps 1e-9
  35.  
  36. int n;
  37.  
  38. int a[200005];
  39.  
  40. bool two = false;
  41.  
  42. int main(){
  43. map<int, __int128> mp;
  44. scanf("%d", &n);
  45. int ik;
  46. ll ak;
  47. forn(i, n){
  48. scanf("%d %lld", &ik, &ak);
  49. mp[ik] = ak;
  50. a[i] = ik;
  51. }
  52.  
  53. sort(a, a+n);
  54. __int128 add= 0;
  55. __int128 cur = 0;
  56. __int128 already = 0;
  57. ik = a[n-1];
  58. for (; ik > 0; --ik) {
  59. already = mp[ik];
  60. cur = add + already;
  61. if (cur % ik != 0) {
  62. puts("No");
  63. return 0;
  64. }
  65.  
  66. add += cur / ik;
  67. }
  68.  
  69. cout << "Yes";
  70.  
  71. return 0;
  72. }
  73.  
  74.  
  75.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
1 4
2 3
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:43:20: error: template argument 2 is invalid
   map<int, __int128> mp;
                    ^
prog.cpp:43:20: error: template argument 4 is invalid
prog.cpp:43:24: error: invalid type in declaration before ‘;’ token
   map<int, __int128> mp;
                        ^
prog.cpp:49:10: error: invalid types ‘int[int]’ for array subscript
     mp[ik] = ak;
          ^
prog.cpp:54:3: error: expected primary-expression before ‘__int128’
   __int128 add= 0;
   ^
prog.cpp:54:3: error: expected ‘;’ before ‘__int128’
prog.cpp:55:3: error: expected primary-expression before ‘__int128’
   __int128 cur = 0;
   ^
prog.cpp:55:3: error: expected ‘;’ before ‘__int128’
prog.cpp:56:3: error: expected primary-expression before ‘__int128’
   __int128 already = 0;
   ^
prog.cpp:56:3: error: expected ‘;’ before ‘__int128’
prog.cpp:59:7: error: ‘already’ was not declared in this scope
       already = mp[ik];
       ^
prog.cpp:59:22: error: invalid types ‘int[int]’ for array subscript
       already = mp[ik];
                      ^
prog.cpp:60:7: error: ‘cur’ was not declared in this scope
       cur = add + already;
       ^
prog.cpp:60:13: error: ‘add’ was not declared in this scope
       cur = add + already;
             ^
stdout
Standard output is empty