QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#318407#3558. Constellation 3tojCompile Error//C++172.0kb2024-01-31 09:53:202024-01-31 09:53:21

Judging History

This is the latest submission verdict.

  • [2024-01-31 09:53:21]
  • Judged
  • [2024-01-31 09:53:20]
  • Submitted

answer

// S2OJ Submission #1230 @ 1706665999526
Logo TOJ
 比赛
 题库
 小组
 题单
 提交记录
 Hack!
 博客
 应用 
 帮助
 中文 
 2024liuxinguo 
提交记录 #1228
2024liuxinguo (刘信果)
题目
#156. 【QOJ3558】Constellation 3
结果
100
用时
201 ms
内存
28.00 MB
语言
C++ 17
文件大小
1.27 KB
提交时间
2024-01-31 09:51:39
测评时间
2024-01-31 09:51:40
测评历史
 你现在查看的是最新测评结果

[2024-01-31 09:51:40]评测
测评结果:
100
用时:201 ms内存:28.00 MB
 查看
[2024-01-31 09:51:39]提交
详细信息
源代码
answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 2e5 + 1;
int n, m, ans;
vector<int> z[N];
vector<pair<int, int>> st[N];

struct Bcj {
	 vector<int> fa;
	 Bcj(int n) : fa(n+2) {for (int i = 0; i <= n+1; ++i) fa[i] = i;}
	 int find(int x) {return x == fa[x] ? x : fa[x] = find(fa[x]);}
};

struct Szsz {
#define lowbit(x) x & -x
	vector<int> t;
	Szsz(int n) : t(n+1) {}
	int getsum(int i) {
		int sum = 0;
		for (; i; i -= lowbit(i))
			sum += t[i];
		return sum;
	}
	void add(int i, int x) {
		for (; i <= n; i += lowbit(i))
			t[i] += x;
	}
};
/*
7
5 6 2 3 6 7 6
5
7 7 5
3 3 7
3 7 10
1 7 6
4 7 8
*/
signed main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		int a; cin >> a;
		z[a].push_back(i);
	}
	cin >> m;
	for (int i = 1; i <= m; ++i) {
		int x, y, c; cin >> x >> y >> c;
		st[y].push_back(make_pair(x, c));
	}
	Bcj L(n), R(n);
	Szsz cost(n);
	for (int y = 1; y <= n; ++y) {
		for (auto star : st[y]) {
			int x = star.first, c = star.second;
			int C = cost.getsum(x);
			if (c <= C)
				ans += c;
			else {
				ans += C;
				cost.add(L.find(x)+1, c-C);
				cost.add(R.find(x), C-c);
			}
		}
		for (int x : z[y])
			L.fa[x] = x-1, R.fa[x] = x+1;
	}
	cout << ans << endl;
	return 0;
}
源代码: C++ 17
© 2024 S2OJ (build: dev)
服务器时间: 2024-01-31 09:52:54
Based on S2OJ, modified by GoBigorGoHome

Details

answer.code:14:10: error: stray ‘#’ in program
   14 | 提交记录 #1228
      |          ^
answer.code:17:2: error: "156." after # is not a positive integer
   17 | #156. 【QOJ3558】Constellation 3
      |  ^~~~
answer.code:17:7: error: extended character 【 is not valid in an identifier
   17 | #156. 【QOJ3558】Constellation 3
      |       ^
answer.code:17:7: error: extended character 】 is not valid in an identifier
answer.code:29:12: error: invalid digit "9" in octal constant
   29 | 2024-01-31 09:51:39
      |            ^~
answer.code:31:12: error: invalid digit "9" in octal constant
   31 | 2024-01-31 09:51:40
      |            ^~
answer.code:35:13: error: invalid digit "9" in octal constant
   35 | [2024-01-31 09:51:40]评测
      |             ^~
answer.code:40:13: error: invalid digit "9" in octal constant
   40 | [2024-01-31 09:51:39]提交
      |             ^~
answer.code:117:1: error: extended character © is not valid in an identifier
  117 | © 2024 S2OJ (build: dev)
      | ^
answer.code:118:24: error: invalid digit "9" in octal constant
  118 | 服务器时间: 2024-01-31 09:52:54
      |                        ^~
answer.code:2:1: error: ‘Logo’ does not name a type
    2 | Logo TOJ
      | ^~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:62,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:45:
/usr/include/c++/13/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/13/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/13/cstddef:50,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:60,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/type_traits:510:26: error: ‘std::size_t’ has not been declared
  510 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:511:25: error: ‘_Size’ was not declared in this scope
  511 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/13/type_traits:511:31: error: template argument 1 is invalid
  511 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
/usr/include/c++/13/type_traits:617:42: error: template argument 1 is invalid
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/13/type_traits:621:48: error: template argument 1 is invalid
  621 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/13/type_traits:625:51: error: template argument 1 is invalid
  625 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/13/type_traits:629:57: error: template argument 1 is invalid
  629 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1348:57: error: template argument 1 is invalid
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:57: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1357:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1357 |     : ...