답안 #210424

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210424 2020-03-17T10:31:44 Z tleontest1 Nizin (COCI16_nizin) C++14
100 / 100
114 ms 8312 KB
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define int long long
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 5000005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

main(void){
	scanf("%lld",&n);
	FOR scanf("%lld",&a[i]);
	int bas=1;
	int son=n;
	int toso=a[bas];
	int tosa=a[son];
	while(bas<son){
		if(toso<tosa){bas++;toso+=a[bas];cev++;}
		else if(toso>tosa){son--;tosa+=a[son];cev++;}
		else{son--;bas++;tosa=a[son];toso=a[bas];}
	}
	//~ if(to)
	printf("%lld\n",cev);
	return 0;
}

Compilation message

nizin.cpp:34:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(void){
          ^
nizin.cpp: In function 'int main()':
nizin.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
nizin.cpp:36:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  FOR scanf("%lld",&a[i]);
      ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1016 KB Output is correct
2 Correct 15 ms 1272 KB Output is correct
3 Correct 15 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 3064 KB Output is correct
2 Correct 49 ms 3704 KB Output is correct
3 Correct 56 ms 4344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 6240 KB Output is correct
2 Correct 87 ms 6648 KB Output is correct
3 Correct 97 ms 7416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 8056 KB Output is correct
2 Correct 107 ms 8312 KB Output is correct
3 Correct 113 ms 8312 KB Output is correct