QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#120689#6660. 택시 여행He_Ren#Compile Error//C++17739b2023-07-07 09:51:152024-05-26 01:47:17

Judging History

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

  • [2024-05-26 01:47:17]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-07 09:51:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 2e5 + 5;

int n,testid;
int a[MAXN];
int sum[MAXN];

int main(void)
{
	scanf("%d%d",&n,&testid);
	for(int i=1; i<=n; ++i)
		scanf("%d",&a[i]);
	
	if(*min_element(a+1, a+n+1) >= 0)
	{
		printf("0\n");
		return 0;
	}
	
	if(*max_element(a+1, a+n+1) <= 0)
	{
		printf("1\n");
		printf("1\n");
		return 0;
	}
	
	for(int i=1; i<=n; ++i)
		sum[i] = sum[i-1] + a[i];
	
	if(*min_element(sum+1, sum+n+1) >= 0)
	{
		printf("1\n");
		printf("2 %d %d\n",1,n);
		return 0;
	}
	
	if(*max_element(sum+1, sum+n+1) <= sum[n])
	{
		printf("1\n");
		printf("3 %d %d\n",1,n);
		return 0;
	}
	return 0;
}

Details

answer.code: In function ‘int main()’:
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",&n,&testid);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
answer.code:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%d",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccovmjyq.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccgijaer.o:implementer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccgijaer.o: in function `main':
implementer.cpp:(.text.startup+0x35e): undefined reference to `travel(std::vector<long long, std::allocator<long long> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status