답안 #682054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
682054 2023-01-15T12:46:36 Z YENGOYAN 금 캐기 (IZhO14_divide) C++17
컴파일 오류
0 ms 0 KB
/* //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\ \\ // // 271828___182845__904523__53602__ \\ \\ 87___47____13______52____66__24_ // // 97___75____72______47____09___36 \\ \\ 999595_____74______96____69___67 // // 62___77____24______07____66__30_ \\ \\ 35___35____47______59____45713__ // // \\ \\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\// */ 
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <algorithm>#include <random>#include <queue>#include <deque>#include <iomanip>#include <string>#include <tuple>#include <bitset>#include <chrono>#include <ctime>#include <fstream>#include <stack>#include <cstdio> using namespace std;using ll = long long;const int N = 3e5 + 5;const ll mod = 1e9 + 7, inf = LLONG_MAX; struct camp { int x, g, d; }; void solve() { // pref_en[r] - pref_en[l - 1] >= x[r] - x[l - 1] // pref_en[r] - x[r] >= pref_en[l - 1] - x[l - 1] 
int n; cin >> n; vector<camp> v(n); for (int i = 0; i < n; ++i) { cin >> v[i].x >> v[i].g >> v[i].d; } vector<ll> pref(n + 1); for (int i = 1; i <= n; ++i) { pref[i] = pref[i - 1] + v[i - 1].d; } vector<ll> pref_en(n + 1), gold(n + 1); for (int i = 1; i <= n; ++i) { pref_en[i] = pref[i] - v[i - 1].x; gold[i] = gold[i - 1] + v[i - 1].g; } long long ans = 0; //for (int i = 1; i <= n; ++i) cout << pref_en[i] << " \n"[i == n];
for (int i = 1; i <= n; ++i) { ans = max(ans, v[i - 1].g * 1ll); for (int j = i + 1; j <= n; ++j) { if (pref_en[i - 1] >= pref_en[j]) ans = max(ans, gold[j] - gold[i - 1]); } } cout << ans;} int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); //int t; cin >> t; //while (t--) solve();}

Compilation message

divide.cpp:1:334: error: extended character   is not valid in an identifier
    1 | /* //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\ \\ // // 271828___182845__904523__53602__ \\ \\ 87___47____13______52____66__24_ // // 97___75____72______47____09___36 \\ \\ 999595_____74______96____69___67 // // 62___77____24______07____66__30_ \\ \\ 35___35____47______59____45713__ // // \\ \\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\// */ 
      |                                                                                                                                                                                                                                                                                                                                              ^
divide.cpp:10:21: warning: extra tokens at end of #include directive
   10 | #include <algorithm>#include <random>#include <queue>#include <deque>#include <iomanip>#include <string>#include <tuple>#include <bitset>#include <chrono>#include <ctime>#include <fstream>#include <stack>#include <cstdio> using namespace std;using ll = long long;const int N = 3e5 + 5;const ll mod = 1e9 + 7, inf = LLONG_MAX; struct camp { int x, g, d; }; void solve() { // pref_en[r] - pref_en[l - 1] >= x[r] - x[l - 1] // pref_en[r] - x[r] >= pref_en[l - 1] - x[l - 1]
      |                     ^
divide.cpp:10:222: error: extended character   is not valid in an identifier
   10 | #include <algorithm>#include <random>#include <queue>#include <deque>#include <iomanip>#include <string>#include <tuple>#include <bitset>#include <chrono>#include <ctime>#include <fstream>#include <stack>#include <cstdio> using namespace std;using ll = long long;const int N = 3e5 + 5;const ll mod = 1e9 + 7, inf = LLONG_MAX; struct camp { int x, g, d; }; void solve() { // pref_en[r] - pref_en[l - 1] >= x[r] - x[l - 1] // pref_en[r] - x[r] >= pref_en[l - 1] - x[l - 1]
      |                                                                                                                                                                                                                              ^
divide.cpp:10:327: error: extended character   is not valid in an identifier
   10 | #include <algorithm>#include <random>#include <queue>#include <deque>#include <iomanip>#include <string>#include <tuple>#include <bitset>#include <chrono>#include <ctime>#include <fstream>#include <stack>#include <cstdio> using namespace std;using ll = long long;const int N = 3e5 + 5;const ll mod = 1e9 + 7, inf = LLONG_MAX; struct camp { int x, g, d; }; void solve() { // pref_en[r] - pref_en[l - 1] >= x[r] - x[l - 1] // pref_en[r] - x[r] >= pref_en[l - 1] - x[l - 1]
      |                                                                                                                                                                                                                                                                                                                                      ^
divide.cpp:10:358: error: extended character   is not valid in an identifier
   10 | #include <algorithm>#include <random>#include <queue>#include <deque>#include <iomanip>#include <string>#include <tuple>#include <bitset>#include <chrono>#include <ctime>#include <fstream>#include <stack>#include <cstdio> using namespace std;using ll = long long;const int N = 3e5 + 5;const ll mod = 1e9 + 7, inf = LLONG_MAX; struct camp { int x, g, d; }; void solve() { // pref_en[r] - pref_en[l - 1] >= x[r] - x[l - 1] // pref_en[r] - x[r] >= pref_en[l - 1] - x[l - 1]
      |                                                                                                                                                                                                                                                                                                                                                                    ^
divide.cpp:12:191: error: extended character   is not valid in an identifier
   12 | for (int i = 1; i <= n; ++i) { ans = max(ans, v[i - 1].g * 1ll); for (int j = i + 1; j <= n; ++j) { if (pref_en[i - 1] >= pref_en[j]) ans = max(ans, gold[j] - gold[i - 1]); } } cout << ans;} int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); //int t; cin >> t; //while (t--) solve();}
      |                                                                                                                                                                                               ^
divide.cpp:1:334: error: '\U000000a0' does not name a type
    1 | /* //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\ \\ // // 271828___182845__904523__53602__ \\ \\ 87___47____13______52____66__24_ // // 97___75____72______47____09___36 \\ \\ 999595_____74______96____69___67 // // 62___77____24______07____66__30_ \\ \\ 35___35____47______59____45713__ // // \\ \\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\// */ 
      |                                                                                                                                                                                                                                                                                                                                              ^
In file included from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/bits/postypes.h:98:11: error: 'ptrdiff_t' does not name a type
   98 |   typedef ptrdiff_t streamsize; // Signed integral type
      |           ^~~~~~~~~
/usr/include/c++/10/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
   40 | #include <cwchar> // For mbstate_t
  +++ |+#include <cstddef>
   41 | 
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:126:26: error: declaration of 'operator new' as non-function
  126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/10/new:126:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:127:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  127 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/10/new:128:26: error: declaration of 'operator new []' as non-function
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/10/new:128:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:129:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  129 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/10/new:135:29: error: 'std::size_t' has not been declared
  135 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                             ^~~
/usr/include/c++/10/new:137:31: error: 'std::size_t' has not been declared
  137 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                               ^~~
/usr/include/c++/10/new:140:26: error: declaration of 'operator new' as non-function
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/10/new:140:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:140:52: error: expected primary-expression before 'const'
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                    ^~~~~
/usr/include/c++/10/new:142:26: error: declaration of 'operator new []' as non-function
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/10/new:142:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                              ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:142:54: error: expected primary-expression before 'const'
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                      ^~~~~
/usr/include/c++/10/new:149:26: error: declaration of 'operator new' as non-function
  149 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/10/new:149:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  149 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:149:68: error: expected primary-expression before ')' token
  149 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                                                    ^
/usr/include/c++/10/new:150:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  150 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/10/new:151:26: error: declaration of 'operator new' as non-function
  151 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                          ^~~~~~~~
/usr/include/c++/10/new:151:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  151 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:151:68: error: expected primary-expression before ',' token
  151 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                                                    ^
/usr/include/c++/10/new:151:70: error: expected primary-expression before 'const'
  151 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                                                      ^~~~~
/usr/include/c++/10/new:157:26: error: declaration of 'operator new []' as non-function
  157 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/10/new:157:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  157 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                                              ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/10/bits/exception_ptr.h:40,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from divide.cpp:2:
/usr/include/c++/10/new:157:70: error: expected primary-expression before ')' token
  157 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                                                                      ^
/usr/include/c++/10/new:158:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  158 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/10/new:159:26: error: declaration of 'operator new []' as non-function
  159 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
      |                          ^~~~~~~~
/usr/include/c++/10/new:159:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  159 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                              ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iost