제출 #62033

#제출 시각아이디문제언어결과실행 시간메모리
62033mahmoudbadawy운세 보기 2 (JOI14_fortune_telling2)C++17
4 / 100
3024 ms808 KiB
#include <bits/stdc++.h>

using namespace std;

const int N=200005;
int a[N],b[N];
int n,k;

int main()
{
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]);
	for(int i=0;i<k;i++)
	{
		int x;
		scanf("%d",&x);
		for(int j=0;j<n;j++)
			if(a[j]<=x)
				swap(a[j],b[j]);
	}
	long long sum=0;
	for(int i=0;i<n;i++) sum+=a[i];
	cout << sum << endl;
}

컴파일 시 표준 에러 (stderr) 메시지

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&k);
  ~~~~~^~~~~~~~~~~~~~~
fortune_telling2.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
fortune_telling2.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...