QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#360998 | #6786. Let's Chat | matongc233 | Compile Error | / | / | C++14 | 4.2kb | 2024-03-22 17:39:08 | 2024-03-22 17:39:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 110, MOD = 1e9 + 7;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef vector<PII> VPII;
typedef deque<int> DPII;
typedef queue<int> QI;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int n, m, x, y;
PII a[N], b[N], c[N], d[N];
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t;
cin >> t;
while(t--){
cin >> n >> m >> x >> y;
for (int i = 0; i < x; i++)
{
cin >> a[i].first >> a[i].second;
}
for (int i = 0; i < y; i++)
{
cin >> b[i].first >> b[i].second;
}
sort(a, a + x);
sort(b, b + y);
int idxc=0,idxd=0;
c[idxc++]=a[0];
d[idxd++]=b[0];
for (int i = 1; i < x; i++){
if(c[idxc-1].second>=a[i].first){
c[idxc-1].second = max(c[idxc-1].second,a[i].second);
}
else {
c[idxc++] = a[i];
}
}
for (int i = 1; i < y; i++){
if(d[idxd-1].second>=b[i].first){
d[idxd-1].second = max(d[idxd-1].second,b[i].second);
}
else {
d[idxd++] = b[i];
}
}
ll res =0;
for(int i=0;i<idxc;i++){
for(int j=0;j<idxd;j++){
if(c[i].second>=d[j].first&&c[i].first<=d[j].second){
int st = max(c[i].first,d[j].first);
int ed = min(c[i].second,d[j].second);
// if(ed-st+1>=m)
res += max(0,ed-m-st+2);
}
// else {
// break;
// }
}
}
cout<<res<<'\n';
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
const int N = 110, MOD = 1e9 + 7;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef vector<PII> VPII;
typedef deque<int> DPII;
typedef queue<int> QI;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int n, m, x, y;
PII a[N], b[N], c[N], d[N];
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t;
cin >> t;
while(t--){
cin >> n >> m >> x >> y;
for (int i = 0; i < x; i++)
{
cin >> a[i].first >> a[i].second;
}
for (int i = 0; i < y; i++)
{
cin >> b[i].first >> b[i].second;
}
sort(a, a + x);
sort(b, b + y);
int idxc=0,idxd=0;
c[idxc++]=a[0];
d[idxd++]=b[0];
for (int i = 1; i < x; i++){
if(c[idxc-1].second>=a[i].first){
c[idxc-1].second = max(c[idxc-1].second,a[i].second);
}
else {
c[idxc++] = a[i];
}
}
for (int i = 1; i < y; i++){
if(d[idxd-1].second>=b[i].first){
d[idxd-1].second = max(d[idxd-1].second,b[i].second);
}
else {
d[idxd++] = b[i];
}
}
ll res =0;
for(int i=0;i<idxc;i++){
for(int j=0;j<idxd;j++){
if(c[i].second>=d[j].first&&c[i].first<=d[j].second){
int st = max(c[i].first,d[j].first);
int ed = min(c[i].second,d[j].second);
// if(ed-st+1>=m)
res += max(0,ed-m-st+2);
}
// else {
// break;
// }
}
}
cout<<res<<'\n';
}
return 0;
}
詳細信息
answer.code:74:2: error: stray ‘#’ in program 74 | }#include <bits/stdc++.h> | ^ answer.code:74:3: error: ‘include’ does not name a type 74 | }#include <bits/stdc++.h> | ^~~~~~~ answer.code:76:11: error: redefinition of ‘const int N’ 76 | const int N = 110, MOD = 1e9 + 7; | ^ answer.code:3:11: note: ‘const int N’ previously defined here 3 | const int N = 110, MOD = 1e9 + 7; | ^ answer.code:76:20: error: redefinition of ‘const int MOD’ 76 | const int N = 110, MOD = 1e9 + 7; | ^~~ answer.code:3:20: note: ‘const int MOD’ previously defined here 3 | const int N = 110, MOD = 1e9 + 7; | ^~~ answer.code:87:5: error: redefinition of ‘int dx []’ 87 | int dx[] = {0, 0, 1, -1}; | ^~ answer.code:14:5: note: ‘int dx [4]’ previously defined here 14 | int dx[] = {0, 0, 1, -1}; | ^~ answer.code:88:5: error: redefinition of ‘int dy []’ 88 | int dy[] = {1, -1, 0, 0}; | ^~ answer.code:15:5: note: ‘int dy [4]’ previously defined here 15 | int dy[] = {1, -1, 0, 0}; | ^~ answer.code:89:5: error: redefinition of ‘int n’ 89 | int n, m, x, y; | ^ answer.code:16:5: note: ‘int n’ previously declared here 16 | int n, m, x, y; | ^ answer.code:89:8: error: redefinition of ‘int m’ 89 | int n, m, x, y; | ^ answer.code:16:8: note: ‘int m’ previously declared here 16 | int n, m, x, y; | ^ answer.code:89:11: error: redefinition of ‘int x’ 89 | int n, m, x, y; | ^ answer.code:16:11: note: ‘int x’ previously declared here 16 | int n, m, x, y; | ^ answer.code:89:14: error: redefinition of ‘int y’ 89 | int n, m, x, y; | ^ answer.code:16:14: note: ‘int y’ previously declared here 16 | int n, m, x, y; | ^ answer.code:90:5: error: redefinition of ‘PII a [110]’ 90 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:17:5: note: ‘PII a [110]’ previously defined here 17 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:90:11: error: redefinition of ‘PII b [110]’ 90 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:17:11: note: ‘PII b [110]’ previously defined here 17 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:90:17: error: redefinition of ‘PII c [110]’ 90 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:17:17: note: ‘PII c [110]’ previously defined here 17 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:90:23: error: redefinition of ‘PII d [110]’ 90 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:17:23: note: ‘PII d [110]’ previously defined here 17 | PII a[N], b[N], c[N], d[N]; | ^ answer.code:92:5: error: redefinition of ‘int main()’ 92 | int main() | ^~~~ answer.code:19:5: note: ‘int main()’ previously defined here 19 | int main() | ^~~~