145752025-01-17 10:45:51badamZenehallgatáscpp17Time limit exceeded 0/50300ms1568 KiB
#include <iostream>
#include <algorithm>

using namespace std;
struct zene
{
    int sorszam, hossz;
};

int main()
{
  int n, m;
  cin >> n >> m;
  zene t[n];
  int f[n];
  for(int i=0;i<n;i++)
  {
      cin >> t[i].hossz;
      t[i].sorszam=i+1;
  }
  for(int i=0;i<m;i++)
  {
      cin >> f[i];
  }
  int osszeg=0;
  int a=0;
  int p=0;
  sort(f,f+m);
  for(int i=0;i<n;i++)
  {
      osszeg=t[i].hossz+osszeg;
  }

  for(int i=0;i<m;i++)
  {
      for(int j=0;j<n;j++)
      {
          a=a+t[j].hossz;
          if(a>=f[i]%osszeg and p==0)
          {
              if(f[i]%osszeg==0)
              {
                  cout << t[n-1].sorszam << " ";
                  p++;
              }
              else
              {

              if(f[i]%osszeg==a)
              {
                  cout << t[j].sorszam << " ";
                  p++;
              }
              if(f[i]%osszeg!=a)
              {
                  cout << t[j].sorszam << " ";
                  p++;
              }
              }
          }
      }
      p=0;
      a=0;
  }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms500 KiB
2Time limit exceeded0/0273ms1332 KiB
3Wrong answer0/26ms316 KiB
4Wrong answer0/26ms500 KiB
5Wrong answer0/26ms316 KiB
6Wrong answer0/36ms408 KiB
7Wrong answer0/36ms316 KiB
8Wrong answer0/36ms316 KiB
9Time limit exceeded0/2300ms1516 KiB
10Time limit exceeded0/2282ms1516 KiB
11Time limit exceeded0/2282ms1340 KiB
12Time limit exceeded0/2277ms1332 KiB
13Time limit exceeded0/2289ms1332 KiB
14Time limit exceeded0/2282ms1332 KiB
15Time limit exceeded0/2282ms1332 KiB
16Time limit exceeded0/2277ms1332 KiB
17Time limit exceeded0/2284ms1440 KiB
18Time limit exceeded0/2300ms1392 KiB
19Time limit exceeded0/2300ms1564 KiB
20Time limit exceeded0/2280ms1472 KiB
21Time limit exceeded0/2270ms1560 KiB
22Time limit exceeded0/3300ms1568 KiB
23Time limit exceeded0/3300ms1504 KiB
24Time limit exceeded0/3275ms1332 KiB