QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#620654#7750. Revenge on My BossxinlengweishangCompile Error//C++20400b2024-10-07 20:04:422024-10-07 20:04:58

Judging History

你现在查看的是最新测评结果

  • [2024-10-07 20:04:58]
  • 评测
  • [2024-10-07 20:04:42]
  • 提交

answer

#include<bits/stdc++.h>
using namesapce std;
struct node{
	int x1,x2;
	int y;
}w[maxn];
bool cmp(node a,node b){
	if(a.y!=b.y) return a.y<b.y;
	return a.x1<b.x1;
}
void slove(){
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++){
		scanf("%d%d%d",&w[i].x1,&w[i].x2,&w[i].y);
	}
	sort(w+1,w+n,cmp);
	for(int i=1;i<=n;i++){
		
	}
}
int main(){
	slove();
	return 0; 
}

详细

answer.code:2:7: error: expected nested-name-specifier before ‘namesapce’
    2 | using namesapce std;
      |       ^~~~~~~~~
answer.code:6:4: error: ‘maxn’ was not declared in this scope
    6 | }w[maxn];
      |    ^~~~
answer.code: In function ‘void slove()’:
answer.code:15:33: error: ‘w’ was not declared in this scope
   15 |                 scanf("%d%d%d",&w[i].x1,&w[i].x2,&w[i].y);
      |                                 ^
answer.code:17:14: error: ‘w’ was not declared in this scope
   17 |         sort(w+1,w+n,cmp);
      |              ^
answer.code:17:9: error: ‘sort’ was not declared in this scope
   17 |         sort(w+1,w+n,cmp);
      |         ^~~~
answer.code:17:9: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:73,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/pstl/glue_algorithm_defs.h:296:1: note:   ‘std::sort’
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
In file included from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/bits/ranges_algo.h:1801:30: note:   ‘std::ranges::sort’
 1801 |   inline constexpr __sort_fn sort{};
      |                              ^~~~
answer.code:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d%d%d",&n,&m,&k);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~